From smorch-ops
Rollback procedure. Invoked by /smo-rollback. SSH to target, check out previous tag, rebuild, reload PM2, verify health. Target SLA 90-120s per project. Includes DB migration reversibility handling.
How this skill is triggered — by the user, by Claude, or both
Slash command
/smorch-ops:rollback-runbookThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Invoked by:** `/smo-rollback`
Invoked by: /smo-rollback
Uses: Same .smorch/project.json deploy config as deploy-pipeline
1. identify-previous → read docs/deploys/*.md, find most recent tag before current
2. preflight → confirm previous tag builds cleanly (rare edge: previous tag broken)
3. ssh-connect → Tailscale IP from project.json
4. checkout-prev → cd {path} && git fetch && git checkout {previous_tag}
5. install → npm ci --production
6. build → npm run build
7. migration-check → if reversibility="auto" → npm run db:rollback; if "manual" → prompt
8. reload → pm2 reload {pm2_name}
9. sleep → wait 10s
10. health-check → curl {health_url} → expect 200 + commit SHA match previous tag
11. log → docs/deploys/YYYY-MM-DD-rollback-{from}-to-{to}.md
12. telegram → SEV2 alert + outcome
{"deploy": {"production": {"rollback_sla_seconds": 90}}}
Breached SLA → log to docs/incidents/sla-breaches.csv.
| Stage | Failure | Action |
|---|---|---|
| 2 preflight | Previous tag doesn't build | SEV1: both current + previous broken. Escalate Mamoun. |
| 7 migration | Reversibility "none" | Halt rollback. Prompt: "This migration is irreversible. Proceed with forward-fix instead?" |
| 10 health check | Previous tag health fails | SEV1 ditto — no known-good version. Manual intervention. |
Per .smorch/project.json:
Migrations must be idempotent + reversible. npm run db:rollback script exists. Executed as step 7.
Rollback halts at step 7, prompts operator: "Run manual migration rollback? (y/n)". Operator runs SQL manually then resumes.
Cannot rollback code because data schema changed irreversibly. Only forward-fix allowed. Rollback halts with error.
After rollback, /smo-incident is typically the next command. The rollback log auto-references the incident file:
Rollback from v1.4.2 → v1.4.1
Triggered by: /smo-deploy --auto (health check failed)
Post-mortem: docs/incidents/2026-04-19-SEV2-rate-limit-bypass.md
Rollbacks are first-class. Using one is not a failure — hiding one is. Log every rollback to trend.csv so monthly /smo-retro can surface deploy quality patterns.
Per SOP-15, every project runs a rollback drill quarterly:
/smo-rollback --dry-runDrills are tracked in docs/drill-log.md.
Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub smorchestra-ai/smorch-dev --plugin smorch-ops