Running Claude Code in Production: Unattended AI Workflows
How we use Claude Code as an unattended teammate for migrations and refactors, where human review is mandatory, and why context hygiene matters.
What We Actually Run Unattended
Unattended AI workflows are most useful when the task has three characteristics: the scope is clear, the acceptable output can be tested automatically, and a human can review the result before it reaches production.
That distinction matters more than the model or tool itself. We do not treat unattended execution as permission for an agent to make unrestricted changes across a client codebase. We treat it as a controlled execution mode for specific classes of engineering work.
For example, a suitable workflow might be:
- Define the exact files, dependency, or subsystem the agent may change.
- Give the agent explicit repository and coding instructions.
- Run the work in an isolated environment or controlled branch.
- Require automated tests, linting, and other relevant checks.
- Have the agent summarize what it changed and any checks that failed.
- Open a pull request rather than deploying directly.
- Have a human engineer review the diff and approve the merge.
This makes the agent responsible for execution, while the engineering team remains responsible for the decision and the outcome.
A Practical Risk Matrix
| Task | Suitable for unattended execution? | Required controls | Human checkpoint |
|---|---|---|---|
| Repetitive dependency migration | Yes, with constraints | Tests, scoped files, rollback | Review the PR |
| Mechanical refactoring | Usually | Unit tests, linting, diff review | Review behavior changes |
| Test generation | Yes | Test execution and coverage review | Check whether tests are meaningful |
| Lint and formatting fixes | Yes | Automated checks | Spot-check the diff |
| UI/design-system refactor | Sometimes | Visual regression testing | Approve visual changes |
| Database migration | Only with strong safeguards | Staging, backups, rollback plan | Verify before production |
| Authentication or authorization | Not fully unattended | Isolated environment, security checks | Senior engineer review |
| Payment or sensitive-data code | Not fully unattended | Strict permissions and testing | Mandatory human review |
| Core product architecture | No | — | Human-led design |
The important point is that “unattended” does not mean “unreviewed.” It means the agent can continue working without a person providing the next prompt at every step.
Where We Draw the Line
Our production workflow deliberately keeps human approval at decisions where correctness cannot be established purely through automated tests.
Architecture and data modeling
An agent can propose an implementation, but choosing between architectures is a business and engineering decision. For example, whether a project should use a headless Next.js frontend or a conventional WordPress architecture depends on requirements such as the team's capabilities, expected traffic, content workflow, integrations, budget, and maintenance model.
Those decisions should not be delegated simply because an AI tool can generate the code.
Security-sensitive code
We treat authentication, authorization, payment processing, secrets, and sensitive customer data as high-risk areas. An agent may assist with implementation or testing, but these changes receive explicit human review before they can be merged.
The same principle applies to changes that expand permissions or introduce a new external integration: the smaller the margin for an unnoticed mistake, the stronger the human checkpoint should be.
The final merge
Our simplest rule is also the most important:
The agent can prepare the pull request. A human owns the decision to merge it.
That gives us a useful separation of responsibility. The AI handles repetitive execution; an experienced engineer remains accountable for whether the resulting change is appropriate for the application and its users.
What We Have Learned About Context
One of the practical problems we have encountered when using coding agents is not simply model capability. It is irrelevant context.
A repository can contain generated files, dependencies, old documentation, unrelated applications, build artifacts, and historical instructions. Giving an agent access to all of that does not automatically make it better informed. It can make the task harder to reason about.
We therefore treat repository context as something to manage deliberately.
Our approach is to:
- exclude directories and generated files that are irrelevant to the task;
- keep project-specific instructions close to the code they describe;
- make coding and testing conventions explicit;
- give the agent a narrowly defined objective;
- inspect what files it actually touched;
- run diagnostics and tests before accepting the result.
There is also a cost reason for doing this. Unnecessary context can increase the amount of information an agent has to process, while irrelevant material can make it harder to identify the files and conventions that actually matter.
The lesson is not that every repository needs an elaborate AI configuration. It is that better-scoped context generally produces a more controllable workflow than simply giving an agent access to everything.
Our Production Rule for AI Coding Agents
After using these workflows, our operating principle is straightforward:
Automate execution where the result is mechanically verifiable. Keep humans responsible for decisions where correctness depends on business context, security, architecture, or judgment.
That distinction is more useful than asking whether AI coding agents are “safe” or “unsafe” in general.
A dependency migration with a strong test suite is a very different risk from changing authentication logic. A formatting refactor is different from changing a payment flow. The right question is therefore not “Can Claude Code do this?” but:
“Can we define, constrain, test, and review this task well enough that unattended execution is an acceptable risk?”
If the answer is yes, an unattended workflow can remove a significant amount of repetitive engineering work. If the answer is no, keeping a human in the loop is not a failure of automation—it is the correct engineering control.
FAQ — Revised
Is unattended Claude Code safe for production?
It can be appropriate for production engineering workflows when execution is tightly scoped and the resulting changes are tested and reviewed before deployment. We do not treat unattended execution as permission to bypass normal engineering controls.
Should an AI agent be allowed to merge its own production code?
Our practice is no. An agent can complete the task, run checks, and open a pull request, but a human engineer remains responsible for reviewing and approving the production merge.
Which coding tasks are best suited to unattended agents?
The strongest candidates are repetitive tasks with a clearly defined scope and objective verification—for example, mechanical migrations, test generation, lint fixes, and other refactors where automated checks can detect many classes of errors.
Which tasks should remain human-led?
Architecture, business-critical logic, security-sensitive changes, authentication and authorization, payment flows, and decisions involving significant product or data-model trade-offs should retain strong human involvement.
What is the biggest mistake when introducing unattended AI coding?
Giving the agent a large repository and an underspecified objective. A better workflow starts with a constrained task, explicit project instructions, appropriate permissions, automated verification, and a defined human approval point.
How does WPFreelance use AI without giving up engineering accountability?
We use AI to accelerate repetitive and mechanically verifiable work while keeping human engineers responsible for architecture, security-sensitive decisions, production review, and the final merge. That is the boundary we use to turn AI acceleration into an engineering workflow rather than an uncontrolled code-generation process.
Planning a website or store?
We design, build, and maintain fast, well-engineered sites. Tell us what you need and we'll come back with a clear plan.
Talk to WPFreelance →