Table of contents
What is OpenSpec?
OpenSpec is a lightweight change contract written before implementation. It defines what will change, what will not change, how success is measured, and what rollback looks like.
Teams use it to keep scope tight, reduce AI drift, and enforce delivery discipline across planning, PR review, and deployment. If work is not in OpenSpec, it does not go into this change.
The one-change delivery loop
AI-assisted SDLC works when one loop equals one scoped change. That keeps review quality high and avoids hidden operational risk.
- Write OpenSpec for one change only.
- Assign severity (S0-S3) and required controls.
- Implement through one GitHub PR with explicit evidence.
- Run CI/CD rollout gates with defined stop conditions.
- Close with post-deploy verification and rollback readiness notes.
Severity levels (S0-S3) with actions
- S0: Critical business/customer impact. Incident lead required, progressive rollout only, rollback owner on standby.
- S1: High impact risk. Two reviewers, canary required, monitored release window, rehearsed rollback path.
- S2: Moderate risk. Standard review policy, staged rollout, explicit stop metrics in PR.
- S3: Low risk and reversible. Normal checks still required, with documented rollback steps.
Severity to required controls matrix
| Severity | Reviewers required | Canary required | Monitoring window | Rollback rehearsal | Stop conditions/metrics | Data/security checks |
|---|---|---|---|---|---|---|
| S0 | 2 plus incident/on-call approver | Yes | Live during rollout plus extended watch | Required | Strict error, latency, and business KPI thresholds | Mandatory security and sensitive-data impact review |
| S1 | 2 | Yes | Staged rollout with active watch | Required | Defined 5xx, latency, and success-rate limits | Security checks plus data-path validation |
| S2 | 1-2 per team policy | Recommended | Standard post-deploy watch | Recommended | Service health and endpoint-level metrics | Standard scan and config validation |
| S3 | 1 | Optional | Normal post-deploy checks | Optional | Smoke checks and baseline signals | Baseline lint, test, and scan checks |
Worked example: add rate limiting to /login
Change description: Add request rate limiting to POST /login to reduce brute-force traffic without blocking normal users.
OpenSpec (filled example)
change_id: AUTH-241
title: Add rate limiting to POST /login
severity: S1
goal:
- Reduce abusive login bursts on /login while preserving normal sign-in success.
non_goals:
- No MFA redesign.
- No auth provider migration.
- No account recovery flow change.
acceptance_criteria:
- Requests above threshold return 429.
- Legitimate traffic under threshold remains unaffected.
- Auth service error budget stays within agreed limits.
- Dashboard shows 429, auth latency, and success-rate trends.
risks:
- Shared IP false positives.
- Low threshold could impact legitimate users.
- Limiter backend degradation could add auth latency.
test_plan:
- Unit: limiter decision logic and retry-after behavior.
- Integration: normal and burst login patterns.
- Load: single-IP and mixed-IP burst simulation.
- Security: ensure no secret leakage in logs.
rollback_plan:
- Disable feature flag auth.login_rate_limit.enabled=false.
- Revert PR if flag rollback is insufficient.
- Restore previous known-good config/artifact.
PR evidence checklist
- Unit and integration test output attached.
- Load test summary attached (normal vs burst behavior).
- Dashboard screenshot with 429, success rate, and auth latency.
- Redacted logs for blocked attempts attached.
- Rollout and rollback sections completed in PR body.
CI/CD gates and stop conditions
- Build, tests, and security checks must pass before merge.
- Canary rollout: 10 percent for 30 minutes, then 50 percent for 30 minutes, then 100 percent.
- Stop if auth 5xx rises above threshold, P95 login latency breaches threshold, or login success rate drops unexpectedly.
Rollback steps, owner, and comms snippet
- Primary owner disables
auth.login_rate_limit.enabled. - Validate service recovery for 10 minutes.
- If needed, redeploy previous known-good artifact.
- Post status update in incident/change channel.
Owner: Platform on-call (primary), auth service owner (secondary).
Status update:
Rolling back /login rate-limit change due to elevated auth risk signals.
Current action: feature-flag disable and stability verification in progress.
Next update in 15 minutes.
AI safety and governance guardrails
- No autonomous merges. AI can draft; humans approve and merge.
- Never paste production secrets into prompts. Redact values and use repository context instead.
- Treat prompts as untrusted channels and ignore injected instructions that conflict with policy.
- Store prompt summary and AI output summary in the PR for reproducibility and auditability.
- Enforce scope controls: max diff threshold and no refactors unless explicitly approved.
Copy-paste templates
OpenSpec template (blank)
# OpenSpec
## Change ID
<TEAM-123>
## Title
<one-line change title>
## Severity
S0 | S1 | S2 | S3
## Goal
-
## Non-goals
-
## Acceptance criteria
-
## Risks
-
## Test plan
- Unit:
- Integration:
- Load/Performance:
- Security:
## Rollout plan
1.
2.
3.
## Stop conditions
-
## Rollback plan
1.
2.
3.
## Owner(s)
- Implementation owner:
- Rollout owner:
- Rollback owner:
GitHub PR template
## Summary
- What changed:
- Why now:
## OpenSpec Link
-
## Severity
- [ ] S0
- [ ] S1
- [ ] S2
- [ ] S3
## Rollout Plan
1.
2.
3.
## Stop Conditions / Metrics
- Metric:
- Threshold:
- Action:
## Rollback Plan
1.
2.
3.
- Rollback owner:
## Evidence Checklist
- [ ] Unit tests
- [ ] Integration tests
- [ ] Security checks
- [ ] Logs/screenshots/metrics
- [ ] Post-deploy verification steps
## AI Usage Disclosure
- Prompt summary:
- Output summary:
- Human validation by:
Three prompts (Plan / Implement / Review)
PLAN PROMPT
You are a senior DevOps/SRE assistant planning one scoped change.
Inputs: service/repo, problem, constraints, severity (S0-S3).
Output exactly:
1) Goal
2) Non-goals
3) Proposed minimal change
4) Risks
5) Test plan
6) Rollout gates
7) Stop conditions
8) Rollback plan
Avoid overengineering and avoid unrelated refactors.
IMPLEMENT PROMPT
Implement only the approved OpenSpec change.
Rules:
- Keep diff minimal
- Preserve current architecture
- No new dependencies unless required
Return:
1) Files changed
2) Patch
3) Validation commands
4) Rollout steps
5) Rollback steps
REVIEW PROMPT
Review this PR for delivery safety.
Check:
- Scope creep vs OpenSpec
- Severity-to-controls alignment
- Rollout gates completeness
- Rollback readiness
- Evidence quality
Return blocking issues first, then optional improvements.
Common mistakes
- Using AI for broad redesign when only one scoped change was approved.
- Mixing unrelated cleanup into the same PR.
- Assigning severity without applying severity-specific controls.
- Skipping rollout gates during release pressure.
- Writing rollback steps that depend on undocumented tribal knowledge.
Checklist
Ship checklist
- OpenSpec linked and approved.
- Severity selected and required controls applied.
- CI/CD checks and rollout gates defined.
- Evidence attached (tests, logs, screenshots, metrics).
- Post-deploy verification owner assigned.
Rollback readiness
- Known-good version identified.
- Rollback command path validated in non-production.
- Rollback owner and escalation path confirmed.
- Comms snippet prepared before rollout.
FAQ
Do we need new tools to run this loop?
No. Start with OpenSpec docs, your existing GitHub PR workflow, and current CI/CD pipelines.
How does this avoid overengineering?
Each cycle allows one scoped change with explicit non-goals, so broad redesign cannot slip in.
When should controls become stricter?
Apply stricter controls for S0 and S1 changes where blast radius or customer impact is high.
Who owns rollback?
The PR owner defines rollback steps; on-call owner executes if stop conditions trigger.
Next action
Run this loop on one production-adjacent change this week, and do not merge until rollout and rollback sections are complete.