Engineering

CI Optimization

Attack one CI bottleneck at a time until the target is met or the bottleneck report is more valuable than another tweak.

Use when

The team is waiting on CI long enough that it changes behavior.

difficultyAdvanced
categoryEngineering
sourcePaul-created

Cadence

Monthly or when CI is painful

Verification

CI p50/p95 improves against the same workflow without weakening tests or hiding failures.

Structured loop spec

FieldValue
NameCI Optimization
CategoryEngineering
TriggerMonthly or when CI is painful
ObjectiveAttack one CI bottleneck at a time until the target is met or the bottleneck report is more valuable than another tweak.
Allowed inputsRelevant files, source notes, logs, tests, screenshots, metrics, or task state for this loop
Allowed actionsMeasure current job and step timing.; Rank bottlenecks by cost and safety.; Optimize one bottleneck with the smallest credible change.; Rerun CI or a faithful local equivalent.; Stop at the target or when no safe gain remains.
VerificationCI p50/p95 improves against the same workflow without weakening tests or hiding failures.
Stop conditionStop when the verifier passes, the budget is exhausted, no progress is made, a blocker appears, or approval is required.
BudgetSet a time, turn, token, retry, file, or dollar cap before running the loop.
Approval boundaryHuman approval required before public, destructive, financial, legal, account, or production-impacting actions.
Safe outputPull request, patch, report, or evidence log
Works withClaude Code, OpenAI Codex, Cursor, Gemini CLI, any tool-using coding agent

Steps

  1. Measure current job and step timing.
  2. Rank bottlenecks by cost and safety.
  3. Optimize one bottleneck with the smallest credible change.
  4. Rerun CI or a faithful local equivalent.
  5. Stop at the target or when no safe gain remains.

Prompt

Reduce CI p50/p95 duration for the selected workflow by the target amount without weakening tests. Measure first, optimize one bottleneck at a time, rerun verification, and finish with before/after timings plus remaining blockers.

Run in Claude Code

Paste this into Claude Code (or any tool-using agent) to run the loop bounded: one change per round, the same verification every round, durable state files, and explicit stop conditions.

Run the "CI Optimization" loop from AI Loop Library (https://ailooplibrary.com/loops/ci-optimization/) as a bounded loop.
Goal: Attack one CI bottleneck at a time until the target is met or the bottleneck report is more valuable than another tweak.
Rules: one change per round; run the same verification every round (CI p50/p95 improves against the same workflow without weakening tests or hiding failures.); append each round to docs/loops/ci-optimization/progress.md and update docs/loops/ci-optimization/state.json; stop on verifier pass, 8 rounds, 3 consecutive failed verifications, no progress, a blocker, or anything needing human approval (money, production, outbound, deletion). Finish with a proof report: rounds used, changes made, verification output, remaining risk, and the next human decision.

Get the MCP server + agent pack

Tags

CIperformancetestingbottlenecks

Related loops

Browse all 68 loops