Engineering
API Contract Drift
Find where the API contract forked and bring every consumer back to one truth.
Use when
Backend, frontend, docs, and SDKs may describe different realities.
Cadence
After API changes or SDK releases
Verification
Server behavior, client types, examples, and docs agree on request/response contracts.
Structured loop spec
| Field | Value |
|---|---|
| Name | API Contract Drift |
| Category | Engineering |
| Trigger | After API changes or SDK releases |
| Objective | Find where the API contract forked and bring every consumer back to one truth. |
| Allowed inputs | Relevant files, source notes, logs, tests, screenshots, metrics, or task state for this loop |
| Allowed actions | Define the exact scope, source of truth, and approval boundary.; Inspect current state and rank the highest-risk gap.; Make one small, reversible improvement.; Run the stated verification and record evidence.; Stop on success, budget, no progress, or approval required. |
| Verification | Server behavior, client types, examples, and docs agree on request/response contracts. |
| Stop condition | Stop when the verifier passes, the budget is exhausted, no progress is made, a blocker appears, or approval is required. |
| Budget | Set a time, turn, token, retry, file, or dollar cap before running the loop. |
| Approval boundary | Human approval required before publishing, sending, deleting, spending, changing accounts, touching production, or making reputational/legal/financial commitments. |
| Safe output | Pull request, patch, report, or evidence log |
| Works with | Claude Code, OpenAI Codex, Cursor, Gemini CLI, any tool-using coding agent |
Steps
- Define the exact scope, source of truth, and approval boundary.
- Inspect current state and rank the highest-risk gap.
- Make one small, reversible improvement.
- Run the stated verification and record evidence.
- Stop on success, budget, no progress, or approval required.
Prompt
Run the API Contract Drift loop. Use it when Backend, frontend, docs, and SDKs may describe different realities. Work in bounded iterations: inspect current state, choose the highest-risk gap, make one reversible improvement, verify it, and record evidence. Stop when Server behavior, client types, examples, and docs agree on request/response contracts. or when blocked, budget exhausted, or approval is required.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 "API Contract Drift" loop from AI Loop Library (https://ailooplibrary.com/loops/api-contract-drift/) as a bounded loop.
Goal: Find where the API contract forked and bring every consumer back to one truth.
Rules: one change per round; run the same verification every round (Server behavior, client types, examples, and docs agree on request/response contracts.); append each round to docs/loops/api-contract-drift/progress.md and update docs/loops/api-contract-drift/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.