cy0307 commited on
Commit
647ce3b
·
verified ·
1 Parent(s): 30cda2b

Sync GitHub f93cf41: explain how to choose an agent loop

Browse files

Mirror the verified GitHub snapshot. Update the loop-selection guide, outcome-led pattern index, responsive website, and regenerated dataset source-line metadata.

data/resources.csv CHANGED
The diff for this file is too large to render. See raw diff
 
data/resources.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
docs/index.html CHANGED
@@ -442,17 +442,77 @@
442
  .principle h3, .card h3, footer h4 { display: flex; align-items: flex-start; gap: 8px; }
443
  .principle h3 .icon, .card h3 .icon, footer h4 .icon { width: 17px; height: 17px; margin-top: 2px; color: var(--blue); }
444
  .principles { margin-top: 34px; }
445
- .pattern-grid { gap: 0; }
446
- .pattern {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
447
  display: block;
448
- min-height: 104px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
449
  color: var(--ink);
450
  text-decoration: none;
451
  transition: color 140ms ease, border-color 140ms ease;
452
  }
 
 
 
453
  .pattern:hover { color: var(--blue); border-color: var(--blue); text-decoration: none; }
454
- .pattern .sym { display: block; color: var(--quiet); font-size: 0.78rem; }
455
- .pattern .name { display: block; margin-top: 7px; font-weight: 750; }
 
 
 
 
 
 
 
 
 
 
 
456
  .filter-row { display: flex; align-items: center; gap: 18px; margin: 0 0 16px; }
457
  .pattern-filter {
458
  width: min(100%, 460px);
@@ -464,6 +524,7 @@
464
  background: var(--surface);
465
  }
466
  .pattern-filter::placeholder { color: var(--quiet); }
 
467
  .filter-empty { margin: 0 0 18px; color: var(--muted); }
468
 
469
  .card { display: block; color: var(--ink); text-decoration: none; }
@@ -704,6 +765,14 @@
704
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
705
  .stat:last-child { grid-column: 1 / -1; border-left: 0; }
706
  .principles, .link-grid, .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
 
 
 
 
 
 
 
 
707
  .future-grid { grid-template-columns: 1fr; }
708
  .future-track { padding: 20px 0; }
709
  .future-track + .future-track { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
@@ -907,7 +976,19 @@
907
  .principles, .link-grid, .pattern-grid, .footer-grid { grid-template-columns: 1fr; }
908
  .principle + .principle, .card + .card, .pattern + .pattern { padding-left: 0; }
909
  .principle, .card, .pattern { padding-top: 16px; padding-bottom: 16px; }
910
- .pattern { min-height: 78px; }
 
 
 
 
 
 
 
 
 
 
 
 
911
  .resource-toolbar { grid-template-columns: 1fr; }
912
  .resource-toolbar label:first-child { grid-column: auto; }
913
  .resource-select { padding-inline: 10px; font-size: 0.86rem; }
@@ -936,13 +1017,6 @@
936
  .resource-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
937
  .resource-toolbar label:first-child { grid-column: 1 / -1; }
938
  }
939
- @media (min-width: 480px) and (max-width: 560px) {
940
- .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
941
- .pattern { min-height: 112px; padding-right: 12px; }
942
- .pattern + .pattern { padding-left: 12px; }
943
- .pattern:nth-child(odd) { padding-left: 0; }
944
- .pattern:nth-child(even) { border-left: 1px solid var(--line); }
945
- }
946
  @media (max-width: 340px) {
947
  h1 { font-size: 2.2rem; }
948
  .brand .brand-text { display: none; }
@@ -1016,7 +1090,7 @@
1016
  {
1017
  "@type": "Question",
1018
  "name": "When should you use an agent loop?",
1019
- "acceptedAnswer": { "@type": "Answer", "text": "Use a loop when work recurs and a deterministic check can decide success. If a task is one-off or done depends only on human judgment, a single run is usually enough." }
1020
  },
1021
  {
1022
  "@type": "Question",
@@ -1263,35 +1337,65 @@
1263
  <div class="section-head">
1264
  <div>
1265
  <p class="section-label"><i class="icon" data-lucide="blocks" aria-hidden="true"></i><span>03 / Pattern library</span></p>
1266
- <h2>Start from the problem you have.</h2>
1267
  </div>
1268
- <p class="section-intro">Choose from 20 build, operate, optimize, and govern patterns. Each includes a trigger, evidence gate, durable state, budget, escalation path, worked scenario, and validated contract.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1269
  </div>
 
1270
  <div class="filter-row">
1271
  <input type="search" id="pattern-filter" class="pattern-filter" placeholder="Filter patterns by keyword..." aria-label="Filter patterns by keyword" autocomplete="off">
 
1272
  </div>
1273
  <p id="pattern-filter-empty" class="filter-empty" hidden>No pattern matches that keyword. <a href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/MATRIX.md">Browse the full matrix</a>.</p>
1274
  <div class="pattern-grid" id="pattern-grid">
1275
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/pr-babysitter.md"><span class="sym">"My PR is stuck"</span><span class="name">PR babysitter</span></a>
1276
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/ci-repair-loop.md"><span class="sym">"CI keeps failing"</span><span class="name">CI repair loop</span></a>
1277
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/docs-drift-collector.md"><span class="sym">"The docs may be stale"</span><span class="name">Docs drift collector</span></a>
1278
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/deploy-verifier.md"><span class="sym">"A deploy needs monitoring"</span><span class="name">Deploy verifier</span></a>
1279
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/feedback-clusterer.md"><span class="sym">"Feedback is noisy"</span><span class="name">Feedback clusterer</span></a>
1280
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/dependency-triage-loop.md"><span class="sym">"Updates pile up"</span><span class="name">Dependency triage loop</span></a>
1281
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/evaluation-regression-loop.md"><span class="sym">"Agent evals regressed"</span><span class="name">Evaluation regression loop</span></a>
1282
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/security-review-loop.md"><span class="sym">"Sensitive changes need review"</span><span class="name">Security review loop</span></a>
1283
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/cost-control-loop.md"><span class="sym">"Agent spend is rising"</span><span class="name">Cost-control loop</span></a>
1284
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/bug-hunting-loop.md"><span class="sym">"Recurring bug discovery"</span><span class="name">Bug hunting loop</span></a>
1285
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/enterprise-approval-loop.md"><span class="sym">"A change needs sign-off"</span><span class="name">Enterprise approval loop</span></a>
1286
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/incident-response-loop.md"><span class="sym">"An incident just paged"</span><span class="name">Incident response loop</span></a>
1287
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/data-quality-loop.md"><span class="sym">"A dataset keeps drifting"</span><span class="name">Data-quality loop</span></a>
1288
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/release-note-loop.md"><span class="sym">"Release notes are a chore"</span><span class="name">Release-note loop</span></a>
1289
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/model-routing-loop.md"><span class="sym">"Model choice is ad hoc"</span><span class="name">Model-routing loop</span></a>
1290
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/benchmark-optimization-loop.md"><span class="sym">"A stable system should improve"</span><span class="name">Benchmark optimization</span></a>
1291
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/knowledge-freshness-loop.md"><span class="sym">"The agent's knowledge is stale"</span><span class="name">Knowledge freshness</span></a>
1292
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/performance-regression-loop.md"><span class="sym">"Performance regressed"</span><span class="name">Performance regression</span></a>
1293
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/accessibility-regression-loop.md"><span class="sym">"Accessibility checks failed"</span><span class="name">Accessibility regression</span></a>
1294
- <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/adversarial-red-team-loop.md"><span class="sym">"The agent needs adversarial testing"</span><span class="name">Adversarial red team</span></a>
1295
  </div>
1296
  </div>
1297
  </section>
@@ -1316,8 +1420,8 @@
1316
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/github-agentic-workflow.md"><span class="runtime-kind">Adaptable template</span><h3><i class="icon" data-lucide="badge-check" aria-hidden="true"></i>GitHub agentic workflow</h3><p>Use when GitHub events or cron should produce issues, artifacts, or pull requests.</p></a>
1317
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/shell-cron-loop.md"><span class="runtime-kind">Adaptable template</span><h3><i class="icon" data-lucide="terminal" aria-hidden="true"></i>Shell / cron</h3><p>Use when an existing agent CLI only needs OS scheduling, locks, and a progress file.</p></a>
1318
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/test-repair-loop.sh"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="play" aria-hidden="true"></i>Test repair</h3><p>Run a failing command, delegate its evidence, and stop only when that same external check passes.</p></a>
1319
- <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/threshold-monitor-loop.sh"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="activity" aria-hidden="true"></i>Threshold monitor</h3><p>Poll a metric, persist samples, and escalate on a breached boundary without auto-remediation.</p></a>
1320
- <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/queue-worker-loop.py"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="list-checks" aria-hidden="true"></i>Queue worker</h3><p>Process bounded JSONL work items with external verification and durable receipts.</p></a>
1321
  </div>
1322
  </div>
1323
  </section>
@@ -1535,7 +1639,7 @@
1535
  </details>
1536
  <details>
1537
  <summary>When should you use an agent loop?</summary>
1538
- <p>Use a loop when work recurs and a deterministic check can decide success. If a task is one-off, or done depends only on human judgment, a single agent run is usually enough.</p>
1539
  </details>
1540
  <details>
1541
  <summary>What belongs in a loop contract?</summary>
 
442
  .principle h3, .card h3, footer h4 { display: flex; align-items: flex-start; gap: 8px; }
443
  .principle h3 .icon, .card h3 .icon, footer h4 .icon { width: 17px; height: 17px; margin-top: 2px; color: var(--blue); }
444
  .principles { margin-top: 34px; }
445
+ .choice-why {
446
+ display: grid;
447
+ grid-template-columns: 220px minmax(0, 1fr);
448
+ gap: 34px;
449
+ margin-bottom: 0;
450
+ border-top: 1px solid var(--line-strong);
451
+ border-bottom: 1px solid var(--line);
452
+ padding: 22px 0;
453
+ }
454
+ .choice-why h3 { margin: 0; font-size: 0.96rem; }
455
+ .choice-why p { max-width: 850px; margin: 0; color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
456
+ .choice-fit {
457
+ display: grid;
458
+ grid-template-columns: repeat(2, minmax(0, 1fr));
459
+ margin-bottom: 30px;
460
+ border-bottom: 1px solid var(--line-strong);
461
+ }
462
+ .choice-fit-column { min-width: 0; padding: 22px 24px 22px 0; }
463
+ .choice-fit-column + .choice-fit-column { border-left: 1px solid var(--line); padding-left: 24px; }
464
+ .choice-fit-label { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 0.88rem; }
465
+ .choice-fit-label .icon { width: 17px; height: 17px; color: var(--green); }
466
+ .choice-fit-column:last-child .choice-fit-label .icon { color: var(--violet); }
467
+ .choice-fit ul { margin: 12px 0 0; padding-left: 18px; }
468
+ .choice-fit li { margin-top: 7px; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }
469
+ .choice-fit li::marker { color: var(--blue); }
470
+ .choice-steps {
471
+ display: grid;
472
+ grid-template-columns: repeat(4, minmax(0, 1fr));
473
+ border-top: 1px solid var(--line-strong);
474
+ border-bottom: 1px solid var(--line-strong);
475
+ }
476
+ .choice-step { min-width: 0; padding: 20px 20px 20px 0; }
477
+ .choice-step + .choice-step { border-left: 1px solid var(--line); padding-left: 20px; }
478
+ .choice-step .number {
479
  display: block;
480
+ margin-bottom: 8px;
481
+ color: var(--blue);
482
+ font-family: "IBM Plex Mono", ui-monospace, monospace;
483
+ font-size: 0.67rem;
484
+ font-weight: 700;
485
+ }
486
+ .choice-step strong { display: block; font-size: 0.9rem; }
487
+ .choice-step p { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
488
+ .choice-sequence { margin: 16px 0 28px; color: var(--muted); font-size: 0.84rem; line-height: 1.55; }
489
+ .choice-sequence strong { color: var(--ink); }
490
+ .pattern-grid { gap: 0; border-top: 1px solid var(--line-strong); }
491
+ .pattern {
492
+ display: flex;
493
+ min-height: 178px;
494
+ flex-direction: column;
495
  color: var(--ink);
496
  text-decoration: none;
497
  transition: color 140ms ease, border-color 140ms ease;
498
  }
499
+ .pattern-grid .pattern:nth-child(n) { border-top: 0; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); padding: 20px 22px; }
500
+ .pattern-grid .pattern:nth-child(3n+1) { border-left: 0; padding-left: 0; }
501
+ .pattern-grid .pattern:nth-child(3n) { padding-right: 0; }
502
  .pattern:hover { color: var(--blue); border-color: var(--blue); text-decoration: none; }
503
+ .pattern .category {
504
+ display: block;
505
+ margin-bottom: 8px;
506
+ color: var(--blue);
507
+ font-family: "IBM Plex Mono", ui-monospace, monospace;
508
+ font-size: 0.62rem;
509
+ font-weight: 650;
510
+ text-transform: uppercase;
511
+ }
512
+ .pattern .sym { display: block; color: var(--quiet); font-size: 0.76rem; line-height: 1.4; }
513
+ .pattern .name { display: block; margin-top: 6px; font-weight: 760; line-height: 1.35; }
514
+ .pattern .outcome { display: block; margin-top: auto; padding-top: 14px; color: var(--muted); font-size: 0.74rem; line-height: 1.5; }
515
+ .pattern .outcome strong { color: var(--ink); }
516
  .filter-row { display: flex; align-items: center; gap: 18px; margin: 0 0 16px; }
517
  .pattern-filter {
518
  width: min(100%, 460px);
 
524
  background: var(--surface);
525
  }
526
  .pattern-filter::placeholder { color: var(--quiet); }
527
+ .filter-row > a { margin-left: auto; font-size: 0.8rem; font-weight: 700; }
528
  .filter-empty { margin: 0 0 18px; color: var(--muted); }
529
 
530
  .card { display: block; color: var(--ink); text-decoration: none; }
 
765
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
766
  .stat:last-child { grid-column: 1 / -1; border-left: 0; }
767
  .principles, .link-grid, .pattern-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
768
+ .choice-why { grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
769
+ .choice-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
770
+ .choice-step:nth-child(n) { border-left: 1px solid var(--line); padding: 18px; }
771
+ .choice-step:nth-child(2n+1) { border-left: 0; padding-left: 0; }
772
+ .choice-step:nth-child(n+3) { border-top: 1px solid var(--line); }
773
+ .pattern-grid .pattern:nth-child(n) { border-left: 1px solid var(--line); padding: 20px; }
774
+ .pattern-grid .pattern:nth-child(2n+1) { border-left: 0; padding-left: 0; }
775
+ .pattern-grid .pattern:nth-child(2n) { padding-right: 0; }
776
  .future-grid { grid-template-columns: 1fr; }
777
  .future-track { padding: 20px 0; }
778
  .future-track + .future-track { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
 
976
  .principles, .link-grid, .pattern-grid, .footer-grid { grid-template-columns: 1fr; }
977
  .principle + .principle, .card + .card, .pattern + .pattern { padding-left: 0; }
978
  .principle, .card, .pattern { padding-top: 16px; padding-bottom: 16px; }
979
+ .choice-why { grid-template-columns: 1fr; gap: 7px; padding: 18px 0; }
980
+ .choice-why p { font-size: 0.84rem; line-height: 1.55; }
981
+ .choice-fit { grid-template-columns: 1fr; margin-bottom: 24px; }
982
+ .choice-fit-column { padding: 18px 0; }
983
+ .choice-fit-column + .choice-fit-column { border-top: 1px solid var(--line); border-left: 0; padding-left: 0; }
984
+ .choice-steps { grid-template-columns: 1fr; }
985
+ .choice-step:nth-child(n) { border-top: 1px solid var(--line); border-left: 0; padding: 16px 0; }
986
+ .choice-step:first-child { border-top: 0; }
987
+ .choice-sequence { margin-bottom: 22px; }
988
+ .filter-row { align-items: stretch; flex-direction: column; gap: 10px; }
989
+ .filter-row > a { width: fit-content; margin-left: 0; }
990
+ .pattern-grid .pattern:nth-child(n) { min-height: 0; border-left: 0; padding: 17px 0; }
991
+ .pattern .outcome { margin-top: 12px; padding-top: 0; }
992
  .resource-toolbar { grid-template-columns: 1fr; }
993
  .resource-toolbar label:first-child { grid-column: auto; }
994
  .resource-select { padding-inline: 10px; font-size: 0.86rem; }
 
1017
  .resource-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
1018
  .resource-toolbar label:first-child { grid-column: 1 / -1; }
1019
  }
 
 
 
 
 
 
 
1020
  @media (max-width: 340px) {
1021
  h1 { font-size: 2.2rem; }
1022
  .brand .brand-text { display: none; }
 
1090
  {
1091
  "@type": "Question",
1092
  "name": "When should you use an agent loop?",
1093
+ "acceptedAnswer": { "@type": "Answer", "text": "Use a loop when work recurs, external evidence can verify progress, useful state should persist, actions and budgets can be bounded, and a human owner can handle exceptions. Prefer a supervised run for one-off or mainly subjective work." }
1094
  },
1095
  {
1096
  "@type": "Question",
 
1337
  <div class="section-head">
1338
  <div>
1339
  <p class="section-label"><i class="icon" data-lucide="blocks" aria-hidden="true"></i><span>03 / Pattern library</span></p>
1340
+ <h2>Choose the control policy, not the model.</h2>
1341
  </div>
1342
+ <p class="section-intro">The same agent can repair CI, monitor a rollout, or test a system adversarially. The right loop defines the different trigger, permissions, proof, memory, budget, and human owner each job requires.</p>
1343
+ </div>
1344
+ <div class="choice-why">
1345
+ <h3>Why selection matters</h3>
1346
+ <p>A generic "keep trying" loop can retry a judgment call, let the acting model approve itself, forget evidence between runs, or take write actions where observation and escalation are safer. A pattern gives a recurring job a reviewable operating policy before you adapt the exact contract.</p>
1347
+ </div>
1348
+ <div class="choice-fit">
1349
+ <div class="choice-fit-column">
1350
+ <h3 class="choice-fit-label"><i class="icon" data-lucide="repeat-2" aria-hidden="true"></i>Use a loop when</h3>
1351
+ <ul>
1352
+ <li>Work returns through a schedule, event, queue, or recurring condition.</li>
1353
+ <li>An external check can prove progress or completion.</li>
1354
+ <li>State, permissions, retries, cost, and human handoff can be bounded.</li>
1355
+ </ul>
1356
+ </div>
1357
+ <div class="choice-fit-column">
1358
+ <h3 class="choice-fit-label"><i class="icon" data-lucide="timer" aria-hidden="true"></i>Use one supervised run when</h3>
1359
+ <ul>
1360
+ <li>The task is genuinely one-off.</li>
1361
+ <li>Completion depends mainly on open-ended human judgment.</li>
1362
+ <li>No safe permission boundary or useful persistent state can be defined.</li>
1363
+ </ul>
1364
+ </div>
1365
+ </div>
1366
+ <div class="choice-steps" aria-label="Four decisions for choosing an agent loop">
1367
+ <div class="choice-step"><span class="number">01</span><strong>Name the recurring job</strong><p>Identify the signal that returns and the outcome that should improve.</p></div>
1368
+ <div class="choice-step"><span class="number">02</span><strong>Define proof</strong><p>Name evidence a machine or reviewer can inspect to decide pass.</p></div>
1369
+ <div class="choice-step"><span class="number">03</span><strong>Bound action</strong><p>Set readable and writable scope, non-goals, retries, time, and cost.</p></div>
1370
+ <div class="choice-step"><span class="number">04</span><strong>Plan the next pass</strong><p>Decide what persists, retries, escalates, or exits after each result.</p></div>
1371
  </div>
1372
+ <p class="choice-sequence"><strong>Pattern → contract → runtime.</strong> Select the operating model below, adapt its validated contract to your environment, then choose where it runs based on persistence, isolation, and permissions.</p>
1373
  <div class="filter-row">
1374
  <input type="search" id="pattern-filter" class="pattern-filter" placeholder="Filter patterns by keyword..." aria-label="Filter patterns by keyword" autocomplete="off">
1375
+ <a href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/MATRIX.md">Compare every contract field →</a>
1376
  </div>
1377
  <p id="pattern-filter-empty" class="filter-empty" hidden>No pattern matches that keyword. <a href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/MATRIX.md">Browse the full matrix</a>.</p>
1378
  <div class="pattern-grid" id="pattern-grid">
1379
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/pr-babysitter.md"><span class="category">Build &amp; maintain</span><span class="sym">"My PR is stuck"</span><span class="name">PR babysitter</span><span class="outcome"><strong>Done when:</strong> checks pass, review threads resolve, and merge state is current.</span></a>
1380
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/ci-repair-loop.md"><span class="category">Build &amp; maintain</span><span class="sym">"CI keeps failing"</span><span class="name">CI repair loop</span><span class="outcome"><strong>Done when:</strong> the original failing command passes with a scoped patch.</span></a>
1381
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/docs-drift-collector.md"><span class="category">Build &amp; maintain</span><span class="sym">"The docs may be stale"</span><span class="name">Docs drift collector</span><span class="outcome"><strong>Done when:</strong> verified mismatches are patched and examples still run.</span></a>
1382
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/dependency-triage-loop.md"><span class="category">Build &amp; maintain</span><span class="sym">"Updates pile up"</span><span class="name">Dependency triage loop</span><span class="outcome"><strong>Done when:</strong> safe updates pass tests and risky upgrades have an owner.</span></a>
1383
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/bug-hunting-loop.md"><span class="category">Build &amp; maintain</span><span class="sym">"Bugs need systematic discovery"</span><span class="name">Bug hunting loop</span><span class="outcome"><strong>Done when:</strong> each accepted finding has a reproduction or failing test.</span></a>
1384
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/release-note-loop.md"><span class="category">Build &amp; maintain</span><span class="sym">"Release notes are a chore"</span><span class="name">Release-note loop</span><span class="outcome"><strong>Done when:</strong> every shipped change maps to a source and audience note.</span></a>
1385
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/deploy-verifier.md"><span class="category">Operate &amp; observe</span><span class="sym">"A deploy needs monitoring"</span><span class="name">Deploy verifier</span><span class="outcome"><strong>Done when:</strong> synthetic checks and rollout thresholds remain within policy.</span></a>
1386
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/incident-response-loop.md"><span class="category">Operate &amp; observe</span><span class="sym">"An incident just paged"</span><span class="name">Incident response loop</span><span class="outcome"><strong>Done when:</strong> impact, evidence, timeline, and accountable owner are recorded.</span></a>
1387
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/data-quality-loop.md"><span class="category">Operate &amp; observe</span><span class="sym">"A dataset keeps drifting"</span><span class="name">Data-quality loop</span><span class="outcome"><strong>Done when:</strong> hard quality rules pass before a version is promoted.</span></a>
1388
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/cost-control-loop.md"><span class="category">Operate &amp; observe</span><span class="sym">"Agent spend is rising"</span><span class="name">Cost-control loop</span><span class="outcome"><strong>Done when:</strong> spend falls on comparable work without quality regression.</span></a>
1389
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/model-routing-loop.md"><span class="category">Operate &amp; observe</span><span class="sym">"Model choice is ad hoc"</span><span class="name">Model-routing loop</span><span class="outcome"><strong>Done when:</strong> routing meets quality, latency, privacy, and cost tolerances.</span></a>
1390
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/performance-regression-loop.md"><span class="category">Operate &amp; observe</span><span class="sym">"Performance regressed"</span><span class="name">Performance regression loop</span><span class="outcome"><strong>Done when:</strong> a controlled benchmark confirms recovery and correctness.</span></a>
1391
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/feedback-clusterer.md"><span class="category">Learn &amp; optimize</span><span class="sym">"Feedback is noisy"</span><span class="name">Feedback clusterer</span><span class="outcome"><strong>Done when:</strong> themes cite sources and separate frequency from severity.</span></a>
1392
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/evaluation-regression-loop.md"><span class="category">Learn &amp; optimize</span><span class="sym">"Agent evals regressed"</span><span class="name">Evaluation regression loop</span><span class="outcome"><strong>Done when:</strong> targeted evals return to baseline without scorer changes.</span></a>
1393
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/benchmark-optimization-loop.md"><span class="category">Learn &amp; optimize</span><span class="sym">"A stable system should improve"</span><span class="name">Benchmark optimization loop</span><span class="outcome"><strong>Done when:</strong> repeated measurements improve with protected metrics intact.</span></a>
1394
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/knowledge-freshness-loop.md"><span class="category">Learn &amp; optimize</span><span class="sym">"The agent's knowledge is stale"</span><span class="name">Knowledge freshness loop</span><span class="outcome"><strong>Done when:</strong> the corpus passes provenance, freshness, retrieval, and leakage gates.</span></a>
1395
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/security-review-loop.md"><span class="category">Govern &amp; protect</span><span class="sym">"Sensitive changes need review"</span><span class="name">Security review loop</span><span class="outcome"><strong>Done when:</strong> findings cite evidence and approval boundaries stay intact.</span></a>
1396
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/enterprise-approval-loop.md"><span class="category">Govern &amp; protect</span><span class="sym">"A change needs sign-off"</span><span class="name">Enterprise approval loop</span><span class="outcome"><strong>Done when:</strong> every gate has a recorded human decision and audit trail.</span></a>
1397
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/accessibility-regression-loop.md"><span class="category">Govern &amp; protect</span><span class="sym">"Accessibility checks failed"</span><span class="name">Accessibility regression loop</span><span class="outcome"><strong>Done when:</strong> the exact regression is fixed and human criteria are approved.</span></a>
1398
+ <a class="pattern" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/patterns/adversarial-red-team-loop.md"><span class="category">Govern &amp; protect</span><span class="sym">"The agent needs adversarial testing"</span><span class="name">Adversarial red-team loop</span><span class="outcome"><strong>Done when:</strong> findings are reproduced, minimized, reported, and regression-tested.</span></a>
1399
  </div>
1400
  </div>
1401
  </section>
 
1420
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/github-agentic-workflow.md"><span class="runtime-kind">Adaptable template</span><h3><i class="icon" data-lucide="badge-check" aria-hidden="true"></i>GitHub agentic workflow</h3><p>Use when GitHub events or cron should produce issues, artifacts, or pull requests.</p></a>
1421
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/shell-cron-loop.md"><span class="runtime-kind">Adaptable template</span><h3><i class="icon" data-lucide="terminal" aria-hidden="true"></i>Shell / cron</h3><p>Use when an existing agent CLI only needs OS scheduling, locks, and a progress file.</p></a>
1422
  <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/test-repair-loop.sh"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="play" aria-hidden="true"></i>Test repair</h3><p>Run a failing command, delegate its evidence, and stop only when that same external check passes.</p></a>
1423
+ <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/threshold-monitor-loop.sh"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="chart-no-axes-combined" aria-hidden="true"></i>Threshold monitor</h3><p>Poll a metric, persist samples, and escalate on a breached boundary without auto-remediation.</p></a>
1424
+ <a class="card" href="https://github.com/ChaoYue0307/awesome-loop-engineering/blob/main/examples/runnable/queue-worker-loop.py"><span class="runtime-kind executable">Executable</span><h3><i class="icon" data-lucide="file-check-2" aria-hidden="true"></i>Queue worker</h3><p>Process bounded JSONL work items with external verification and durable receipts.</p></a>
1425
  </div>
1426
  </div>
1427
  </section>
 
1639
  </details>
1640
  <details>
1641
  <summary>When should you use an agent loop?</summary>
1642
+ <p>Use a loop when work recurs, external evidence can verify progress, useful state should persist, actions and budgets can be bounded, and a human owner can handle exceptions. Prefer one supervised run when the task is one-off, completion is mainly subjective, or no safe permission boundary can be stated.</p>
1643
  </details>
1644
  <details>
1645
  <summary>What belongs in a loop contract?</summary>
patterns/README.md CHANGED
@@ -1,12 +1,14 @@
1
  # Loop Pattern Library
2
 
3
- Twenty operational patterns turn the Loop Contract into repeatable ways of working. Every pattern names the problem, trigger, intake, permissions, roles, deterministic gate, durable state, budget, escalation path, and a matching schema-valid contract.
 
 
4
 
5
  ## Use The Library In Three Steps
6
 
7
- 1. Start from the symptom in the coverage map below.
8
- 1. Open the pattern to understand the operating model and worked example.
9
- 1. Adapt its linked JSON contract, then choose a [runtime starter](../examples/runnable/README.md).
10
 
11
  The layers have different jobs:
12
 
 
1
  # Loop Pattern Library
2
 
3
+ Twenty operational patterns turn the Loop Contract into repeatable ways of working. Choose a pattern because recurring jobs fail in different ways: a PR can wait on checks, a rollout can breach a threshold, and a security review can cross an approval boundary. Each needs its own trigger, permissions, evidence gate, state, budget, and human handoff even when the underlying agent is the same.
4
+
5
+ Use a loop when the work returns, an external signal can verify progress, useful state should survive between runs, and action can be bounded. Prefer one supervised agent run when the task is one-off, completion is mainly subjective, or a safe permission boundary cannot be stated.
6
 
7
  ## Use The Library In Three Steps
8
 
9
+ 1. Start from the recurring symptom and verified outcome in the coverage map below.
10
+ 1. Open the pattern to review its trigger, external gate, state, failure boundaries, and worked example.
11
+ 1. Adapt its linked JSON contract to your permissions and budgets, then choose a [runtime starter](../examples/runnable/README.md).
12
 
13
  The layers have different jobs:
14