SDLC Playbook

Stage 5: Deploy

AI in the PR review loop, hooks as approval gates, and CI/CD with tiered autonomy.

The shift

From reading every line to governing as the agent acts

Review used to depend on how many people were free to read. Now every PR gets the same review passes, and approvals are enforced in the moment.

Traditional

Humans review every line

Governance lives in review cycles, often applied inconsistently. A PR waits for a reviewer to read all of it.

One PR
Waits for a reviewerRead in fullQuality varies with load
AI-native

Layers of agentic review

Human review is reserved for regulated and critical code. Governance is enforced as the AI acts, with hooks as approval gates.

One PR
BugsSecurityComplianceHuman threshold
Claude or an agent does the work A person decides or approves A gate, check or hook committed file
1

AI in the PR review loop

Claude both gives and receives reviews. Engineers focus on behavior: judging intent and risk.

Traditional

Review capacity is planned around human output. A PR waits for a reviewer to read all of it, quality varies with reviewer load, and the author chases while the backlog grows.

AI-native

All PRs get an identical set of review passes, with findings ranked by severity. Human attention moves up a level: does the change do what the plan intended, and is the risk acceptable?

Watch a PR move through review

The insurer status panel PR. Click a stage, or use Play.

  1. Policy: REVIEW.mdPR
  2. Logic, edge cases, regressionsPR
  3. Injection, auth, PII in logsPR
  4. Matches spec and planPR
  5. Nits capped at 5PR
  6. Code owner approvesPR
Nitclaims-api/tests/test_status.py:8Bugs: no test covers a paid claim with no expected date.
Importantclaims-api/routes/status.py:31Security: the error path logs the whole claims-core response, which includes the policy holder's name.
Importantportal/src/claims/StatusPanel.tsx:22Compliance: the panel fetches on every render, but plan.md says it must cache. Only the compliance pass finds this, because it reads the committed plan.
Check runImportant first, then Nits. At most five Nits, the rest as a count.
2

Hooks as approval gates

A hook is a script that runs before Claude acts. It can allow, ask or block. The release gate is the clearest case.

Traditional

Governance lives in review cycles, applied by people, often inconsistently.

AI-native

Governance is enforced as the AI acts. In Stage 3, hooks allowed or blocked with no human. A hook can also ask, pausing until the person running the session confirms. When the approver is someone else, such as a release manager, the hook looks for their recorded approval and blocks until it exists.

Hooks run wherever Claude acts. They can block edits to migrations and infra without a change ticket (Stage 3), and stop the agent editing test files during a fix (Stage 4).

Watch a release meet the gate

The insurer portal ships to dev, staging and production. Each environment has its own deploy tools, and a hook checks every release call.

Agent
Calls release

Release to dev.

Release hook
ALLOW

Dev

Released.

change ticket Release manager approves
The agent may act up to the production gate and cannot pass it.

Managed settings for a regulated enterprise

The platform team deploys these through device management or the admin console. Engineers cannot edit or override them. The course calls this a starting point to customize.

Outer layerManaged settingsowned by the platform team or IT admin
Secrets and networkKeep secret files out of Claude's context. Block network access through tools. Pre-approve a safe inner loop (git, build, test, lint) so people are not worn down by prompts.
Nobody widens the rulesThe bypass mode is off, and only managed permission rules apply.
SandboxThe operating system enforces limits on commands and network domains. If the sandbox cannot start, Claude Code refuses to start.
CredentialsNo reads of SSH keys or cloud credentials. Listed tokens are stripped from sandboxed commands.
Managed hooks onlyOnly managed hooks run. Put the approval gate in the managed file.
Approved marketplaceSkills, agents, hooks and MCP servers come only from the organization's approved plugin marketplace.
Tool allowlistThe agent's tools are an allowlist owned by the platform team.
Version floorClaude Code refuses to start below the approved version.
Trade-offEach deny rule removes some capability. Balance it against the repo's data classification.
Middle layerProject settings in Git.claude/settings.json

Team hooks live here. With "managed hooks only" switched on, project hooks do not run, so the approval gate goes in the outer layer.

Inner layer: Claude's session. It works inside every layer around it and cannot switch any of them off.
3

CI/CD integration and deployment

Run Claude Code non-interactively in the pipeline, sandbox it, expose deployment through MCP, and "rehearse the rollback paths before the agent ever needs them".

Traditional

Pipelines run deterministic scripts. Anything that needs judgment waits for a human: triaging a flaky test, writing the changelog, diagnosing a broken build. Deployment and rollback are runbooks followed under pressure.

AI-native

Claude runs non-interactively in the pipeline for judgment steps, in a sandbox with scoped credentials. Deployment tooling is exposed through MCP, so the workflow that wrote and tested the change can also ship and roll it back, inside gates the organization defines per environment.

Watch autonomy grow in order

Each step stands on the one before it. Click a step, or use Play.

Read-only judgment steps

A step that runs only if the build failed. Claude reads the log, names the likely cause, says whether it looks flaky or real, and writes a three-line summary for the PR thread. It cannot change anything.

Build fails→Claude reads the log→Flaky or real?→Summary on the PR
Write steps behind existing gates

Fix lint, update generated docs, address review comments. Everything the agent writes arrives as a PR. The agent has no route to push to main.

Claude writes a fix→Opens a PR→Branch protection→Code owner approves→Main
Deployment through MCP

Agent jobs run in a sandbox with short-lived scoped tokens and no standing production credentials. There is one MCP server per environment, because an allow rule names the server and tool, not the arguments. That is how an allowlist tells staging from production.

ToolInputReturns
releaseThe version. In production, also a ticket.The release ID once the rollout finishes.
statusNone.Waits until five minutes after the last release, then reports each endpoint's 5xx rate.
rollbackNone.The version that is live again.
Autonomy tiered by environment
EnvironmentOn the allowlistWhat happens to releaseWho approves
Devrelease, status, rollbackThe hook allows.Nobody.
Stagingrelease, status, rollbackThe hook asks, or allows from the pipeline on main.The engineer, or the approved merge.
Productionstatus, rollbackDenied unless the hook allows.Release manager, through a change ticket.

In production, release is off the allowlist, so the hook's allow is the only way through. Production fails closed: if the hook fails to run, the release is denied. Rollback stays allowed because it is a runbook approved in advance.

Rollback is the most rehearsed path

One command the agent can run, exercised regularly in staging. In the example staging job, the agent releases the commit, checks status, and rolls back if any endpoint's 5xx rate is over 1%. The Stage 6 loop calls the same command when a control band is breached.

release→status (5 minutes after)→5xx over 1%?→rollback→Previous version live
Hand-offs

What Deploy hands on

Artifact

A merged PR

It passed the review passes and carries a code owner's approval. PR history is the audit record.

merged PR

Trigger

The pipeline runs

A merge to main starts CI/CD. Staging is allowed from the pipeline on main, because the approved merge is the approval. Production waits at the gate.

Artifact

A release in production

It reached production through the gate, with a rehearsed rollback ready and every gate decision logged.

release + rollback

Trigger

Agents watch the live release

Production hands over to Stage 6: Maintain. When a control band is breached, that loop can call rollback.

Key takeaways

  • Every PR gets the same review passes, written once in REVIEW.md. Humans spend their time on intent and risk.
  • Findings do not approve or block on their own. A code owner still approves, and the tech lead sets the human threshold.
  • Approval gates are hooks. The agent may act up to the production gate and cannot pass it.
  • Grow autonomy in order: read-only steps, write steps behind gates, deployment through MCP, then tiers by environment.
  • Rehearse rollback in staging before the agent ever needs it.

Based on Anthropic's The AI-native SDLC playbook course (Claude Academy). Summarized by Bitovi to guide client transitions.