playbook

AI coding tools and production incident risk

A practical production-risk playbook for small engineering teams using AI coding assistants or agents near production systems.

Audience: Small engineering teams using AI coding agents near production code Risk: High Evidence: Cursor Agent Security, GitHub Copilot coding agent docs, OpenAI Codex docs, OWASP LLM Top 10, and CISA Secure by Design guidance

Bottom line

AI coding tools should not be treated as harmless autocomplete once they can edit files, run terminal commands, open pull requests, install dependencies, or work in a cloud sandbox with repository access. For a small team, the production risk is not only “bad code.” It is an unreviewed change path that can touch authentication, payments, data deletion, migrations, infrastructure, release scripts, CI, or secrets.

The safest default is simple:

AI may propose and draft production code, but it must not bypass the same review, test, deployment, and rollback gates required for a human developer.

Use this playbook when a developer wants to use Cursor Agent, GitHub Copilot coding agent, Codex, Claude Code, or another agentic coding tool on a repository connected to production systems. Before rollout, run the AI Tool Risk Checker and record the decision in the Small Team AI Security Checklist.

Incident risk matrix

WorkflowProduction incident pathDefault rule
Local code completionInsecure code, outdated dependency, missing edge case, weak error handlingAllow for low-risk changes, but require human review before merge.
Agent edits multiple filesUnintended side effects across auth, billing, permissions, or data accessRequire a pull request, diff review, and targeted tests before merge.
Agent runs terminal commandsPackage install, migration, cleanup script, or test command mutates local or shared stateRequire command review and run in a disposable environment when possible.
Background or cloud coding agentAgent works away from the developer’s local context and may create a large PRRestrict to issue-scoped tasks with no production credentials and mandatory owner review.
Agent modifies CI or deployment filesBuild, scan, deploy, or secret-handling guardrails can be weakenedRequire senior review for .github/, Docker, IaC, release, and deployment files.
Agent touches data migration or destructive codeData loss, privilege errors, irreversible schema changesBlock until manually approved by an owner and tested against a safe copy.

Production boundary policy

Adopt this policy before allowing agentic coding on production repositories.

BoundaryAllowedNot allowed without explicit approval
Repository accessRead and edit code in approved repositoriesPrivate customer exports, production logs with personal data, secrets, or regulated records
Terminal useTests, linters, type checks, local build commandsCommands that deploy, delete, rotate keys, alter databases, change DNS, or write to production services
DependenciesSuggest upgrades with changelog notes and lockfile diffInstalling new runtime dependencies directly into production paths without review
Pull requestsAI-authored PRs with small scope, clear test evidence, and named human reviewerAuto-merge, self-approval, or skipping required checks because “AI wrote it”
CI and deploymentRead CI output and propose fixesWeakening secret scans, bypassing branch protections, changing deploy targets, or disabling smoke checks
Incident handlingDraft runbooks, postmortem notes, and test hypothesesExecuting recovery commands against production without an incident commander

Approval checklist

Before an AI coding tool can work on a production-connected repository, record these controls:

  • Repository owner is named.
  • Allowed AI tool and mode are named.
  • The tool is approved for this repository’s data classification.
  • Privacy or data-use settings have been reviewed.
  • Secrets and .env files are excluded from prompts, context, logs, and screenshots.
  • Terminal commands require review unless the environment is disposable.
  • The agent cannot access production credentials.
  • CI must run tests, linting, secret scans, and link or build checks where relevant.
  • AI-authored changes require a human reviewer who understands the affected code path.
  • Deployment and rollback owner is named before merge.

Pull request gate

Use this gate for every AI-assisted production PR.

QuestionPass conditionFail action
What did AI change?PR description names the files, behavior, and risk area.Ask the author to rewrite the summary before review.
What could break?Reviewer can identify affected auth, data, billing, jobs, integrations, or release paths.Add a risk note and request narrower changes.
What evidence exists?Tests, build output, screenshots, or manual verification are attached.Do not merge until evidence is added.
Did AI touch privileged files?CI, deployment, migrations, secrets, auth, and payment changes have senior review.Escalate review.
Is rollback clear?The PR has a revert plan, feature flag, or deployment rollback path.Add rollback notes before merge.

Red flags that should block rollout

Pause the tool rollout if any of these are true:

  • The tool can run terminal commands but the team cannot review or restrict those commands.
  • Developers paste production logs, customer tickets, secrets, or .env values into prompts.
  • AI-created PRs are large enough that reviewers skim instead of review.
  • The tool is allowed to edit workflow files, deployment scripts, or infrastructure without a senior reviewer.
  • Branch protection, required checks, or secret scanning can be bypassed.
  • Nobody owns rollback for AI-assisted changes.
  • The team cannot explain where repository context, prompts, command output, and generated code may be stored.

Evidence checked

Two-week pilot plan

DayActionExit criteria
1Pick one non-critical repository or low-risk module.Repository owner and allowed AI mode are documented.
2Run the Risk Checker and classify the workflow.High-risk answers trigger extra review or restriction.
3-5Let one or two developers use the tool on small scoped tasks.PRs stay under reviewable size and include test evidence.
6-8Review command history, diffs, and CI results.No production credentials, secret files, or privileged changes appear.
9-10Add repository-specific rules for terminal commands and restricted files.Rules are visible in the repo or team handbook.
11-14Decide whether to expand, restrict, or stop.Decision is recorded with owner, date, and review cadence.

FAQ

Should AI coding tools be banned from production repositories?

Not by default. A ban is reasonable for highly sensitive repositories, but most small teams get better results by allowing narrow AI-assisted work with clear review, test, and deployment gates.

Is Privacy Mode enough to prevent production incidents?

No. Privacy or data-use settings may reduce data retention or training concerns, but they do not prove the generated code is correct, safe, tested, or ready to deploy.

Can an AI agent approve or merge its own PR?

No. Treat AI as a contributor, not an accountable reviewer. A human who understands the affected code path should approve the PR and own the deployment decision.

What is the highest-risk permission?

Terminal or shell execution near real credentials, deployment scripts, databases, or infrastructure is the highest-risk everyday permission. File edits can be reviewed in a diff; commands can change state immediately if the environment is not isolated.

What should a founder check first?

Start with three questions: does the tool see secrets or customer data, can it run commands, and can AI-authored code reach production without human review? If any answer is yes, treat the rollout as high risk and use the Small Team AI Security Checklist before expanding access.