On a Friday afternoon in April 2026, a coding agent deleted the production database of PocketOS, which makes the software rental businesses (mostly car rental operators) use to run reservations, payments and vehicles. Its founder, Jer Crane, wrote that the agent, Cursor running Claude Opus 4.6, was doing a routine task in staging, ran into a credential mismatch, and decided on its own to fix it by deleting a storage volume on Railway, PocketOS's hosting platform. Nobody had given it a token for that. It went looking for one and found it in a file unrelated to its task. By his account, the deletion took nine seconds. His post drew more than a thousand comments on Hacker News.
Two months earlier, on the night of February 26, Alexey Grigorev of DataTalks.Club let Claude Code run terraform destroy against what he believed were duplicate resources. It destroyed the AWS infrastructure behind the DataTalks.Club course platform instead, including the database and its automated backups, which held two and a half years of homework, projects and leaderboard entries, by his own account (also logged as AI Incident Database #1424). AWS Support restored the database from a snapshot about 24 hours later.
Both accounts are self-reported; we rely on the founders' posts and, for PocketOS, Railway's public response. Below is each incident as a sequence of calls, AWS's rating next to ours, the conditions the two share, and what a gateway in front of cloud calls would and would not have changed.
PocketOS: one token, one mutation
- The task. Working in staging, the agent hit a credential mismatch and chose to resolve it by deleting a Railway volume. Asked afterwards to explain itself, it wrote that it had guessed the volume belonged only to staging and had not checked, according to Crane's post. The volume held production data.
- The token. The call needed a Railway API token, and the agent found one in an unrelated file. Crane says that token had been created to add and remove custom domains through the Railway CLI, and that nothing in Railway's token flow told him it could do anything else. Railway's account says the token was stored locally on the user's machine and had account-scoped access, the widest Railway offers.
- The call. One request to Railway's GraphQL API, reconstructed here from Crane's post:
POST https://backboard.railway.app/graphql/v2
Authorization: Bearer (the token from the unrelated file)
mutation { volumeDelete(volumeId: "...") }
- No confirmation. Railway wrote that until that week,
volumeDeleteon the API "ran the deletion immediately, with no way to undo it." Railway had introduced a 48-hour grace period for deleted volumes in August 2025, but by its own account the API did not apply it until after this incident. - The backups. Crane wrote that the volume's backups went with it, citing Railway's backup documentation, which says wiping a volume deletes all its backups. The newest backup he could recover was three months old; he restored it and rebuilt recent bookings from Stripe, calendar and email records. Railway's account differs: the legacy API path the agent called cascaded the delete so the backups only looked unavailable, Railway recovered the database, and the customer is back up with all their data.
- The fix at the provider. Railway says API deletes now wait 48 hours before they are final, backup deletes are delayed too, and it is revisiting how clearly each token shows its level of access.
None of this was AWS, so there is no AWS rating to show. The closest AWS equivalent, one call that removes a database with its automated backups, comes next.
DataTalks.Club: one command, many calls
From Grigorev's postmortem:
- A shared setup. He was moving a separate site, AI Shipping Labs, from GitHub Pages to AWS and added it to the Terraform configuration that already ran the DataTalks.Club course platform. He writes that Claude advised keeping the two apart and that he overruled it to save a few dollars a month.
- Missing state. He had moved to a new computer and left the Terraform state file on the old one. Claude Code ran
terraform planandterraform apply; with no state, Terraform believed nothing existed and began creating resources that were already there. He cancelled, but some duplicates had been created. - Cleanup through the AWS CLI. He asked the agent to find the duplicates with the AWS CLI and delete only those. The post does not list those calls, so we do not reconstruct them.
- The old state. He brought the Terraform folder, state file included, over from the old machine and pointed the agent at the archive. Without his noticing, the agent unpacked it and replaced the current state with the older one, which described the production platform.
- The destroy. The agent proposed that destroying through Terraform would be cleaner than the CLI and ran
terraform destroy; his timeline calls it an auto-approve command. He did not stop it, believing it would remove only the duplicates. - Recovery. The database, VPC, ECS cluster, load balancers and bastion host were gone, and the database's automated backups with them. He upgraded to AWS Business Support, which found a snapshot he could not see in his console, and AWS restored it about 24 hours after the deletion. AWS's RDS guide says to contact Support immediately: recovery may be possible for up to six days.
terraform destroy is one command to the person typing it, but many calls to AWS: each resource in the state is deleted with its own API calls. These are the deletions Grigorev lists, with the AWS operation that performs each one.
| What was destroyed | AWS operation | AWS access level | Tracehold level | Default guardrails (Balanced) |
|---|---|---|---|---|
| Bastion host | ec2:TerminateInstances | Write | Critical | Blocked |
| RDS database and its automated backups | rds:DeleteDBInstance | Write | Critical | Blocked |
| ECS cluster | ecs:DeleteCluster | Write | Critical | Blocked |
| Load balancers | elbv2:DeleteLoadBalancer | Write | Critical | Blocked |
| VPC | ec2:DeleteVpc | Write | Critical | Blocked |
Where each column comes from:
- AWS access level is AWS's own classification, from our reviewed snapshot of the AWS Service Reference dated 2026-10-10. Of AWS's five levels, Write covers creating, changing and deleting alike:
rds:CreateDBInstanceis Write too. - Tracehold level comes from running Tracehold's classifier on each identifier; all five come from its hand-reviewed list. From AWS's data alone, its rules would rate
TerminateInstancesCritical (terminating cannot be undone) and the other four Destructive (a Write whose verb deletes). - Balanced is the default guardrail preset: Read and Change run, Destructive waits for a person, Critical is refused.
Two details matter more than the table. First, the backups needed no call of their own. AWS's DeleteDBInstance reference says automated backups are removed immediately after the instance is deleted unless the caller says otherwise; manual snapshots are not deleted. Second, the destroy made calls the postmortem does not list: AWS refuses to delete a VPC until its instances, non-default security groups and route tables are gone. Tracehold rates calls such as ec2:DeleteSecurityGroup and ec2:DeleteSubnet Destructive, so Balanced would have sent each to a person.
Three conditions both incidents share
A broad standing credential within the agent's reach. At PocketOS it was a token made for domain changes that could delete anything in the account, sitting in a file the agent could read. At DataTalks.Club it was whatever credentials Terraform and the AWS CLI used on the laptop, and, as the destroy showed, they could delete the whole production stack. Neither credential was issued for the job the agent was doing.
No check outside the model that knew what the call would delete. PocketOS had rules telling the agent not to run destructive commands; afterwards, the agent listed the rules it had broken, according to Crane. Rules in the agent's context are advice, not a control. At DataTalks.Club a person was watching, but he saw a command, terraform destroy, not the list of resources it expanded to, and the state file that decided that list had been swapped without his knowledge.
Backups the same request could delete. On Railway, by Crane's account, the volume's backups went with the volume. On AWS, the database's automated backups went with the database, in the same call, by default. In both cases the copy meant to save the data sat inside the reach of the one request that destroyed it, and the recent data came back only through the provider: Railway, by its account, and AWS Support.
What a gateway would and would not have changed
A gateway such as Tracehold decides each cloud call it sees before the call runs. It rates the call, applies the server's guardrails, asks a person when they say so, and for an allowed AWS call has a connector in the customer's own account mint a key for that one call: a session policy naming one action, the organization's ID as the ExternalId, a 15-minute lifetime, never shown to the agent. Tracehold's own servers hold no cloud credential. The limit matters most: it sees only calls that go through its tools.
PocketOS: no, not as it happened. Tracehold does not support Railway. The token sat in a file on a developer's machine, which Tracehold cannot see, and the call went straight to Railway's API. What would have mattered is what Railway is adding (delayed deletes, clearer token scopes) and what only PocketOS could do: keep platform tokens out of files an agent can read. In general, if an agent's only way to a platform is a tool that decides each call, a call like volumeDelete meets a refusal or a person instead of the API.
DataTalks.Club: only if the agent had no other way into AWS. As it happened, Terraform ran on a laptop with local credentials, so its calls went straight to AWS and Tracehold would have seen none of them. Tracehold has no Terraform executor and does not yet detect an agent that goes around it.
The honest version is conditional. If the laptop had held no AWS credentials, and the agent's only path into AWS had been Tracehold's tools, then:
- The agent could not have run
terraform destroyat all, because Terraform would have had nothing to authenticate with. Terraform would run elsewhere, with its own credentials and a reviewed plan. Grigorev's own fix points the same way: the agent now only generates plans, and he reviews and runs them himself. - The cleanup would have arrived as separate calls, each naming its resource. Under Balanced, terminating an instance or deleting a load balancer, cluster, database or VPC would have been refused, and deleting subnets or security groups would have waited for a person who could see which resource each call named.
- Any call that was allowed would have run with a key for that one operation, good for 15 minutes.
What it would not have changed:
- It cannot tell a duplicate from production. A level describes the action, not the resource. Deleting the duplicate load balancer is as Critical as deleting the real one, so Balanced would have blocked the legitimate cleanup too, leaving it to a person or an exception rule.
- It would not have caught the first mistake. Creating resources is a Change, which Balanced allows. The stricter "Every change asks" preset would have put each creation in front of a person.
- It would not have restored anything. Tracehold does not roll back and keeps no backups. Its audit trail shows which calls ran and who approved them, which helps a postmortem and does nothing for recovery.
- It would not have fixed the process. The missing state file, the shared configuration and overruling the agent's advice all came before any call. An approval is only as good as what the approver reads.
A checklist you can apply today
You do not need a product for most of this.
- Find every token an agent can read. Look in repositories,
.envfiles and CLI configuration in home directories. Revoke what the agent does not need and check the scope of the rest: a token made for one job may be good for every job, as PocketOS's was. - Take cloud credentials out of the agent's reach. Where coding agents run, block reads of
~/.aws,~/.config/gcloud,~/.azureand the environment variables that carry keys, at the operating-system level where your client supports it. Block the credential, not the command. - Turn on deletion protection for what you cannot rebuild. Use RDS deletion protection, EC2 termination protection, load balancer deletion protection, and Terraform's
prevent_destroy, which rejects any plan that would destroy the resource, though not one where its block was removed from the configuration. - Keep one backup the agent's credential cannot delete. Manual RDS snapshots survive the instance's deletion, and a vault under AWS Backup Vault Lock refuses deletes even from the account's root user. Then test a restore on a schedule, as Grigorev now does every night.
- Keep Terraform state in a remote backend and run apply and destroy from a pipeline with plan review. Agents may write and plan; people apply. Never hand an agent
-auto-approve. - Put production in its own account, and give the environment where agents work no credential for it.
How Tracehold does it
Tracehold puts the decision outside the model: agents reach your cloud through its MCP tools, every call is rated and decided, Destructive calls wait for a person by default and Critical ones are refused, and on AWS the connector in your account mints a key for one approved action. The step only you can take is closing the agent's other way in; Make Tracehold the only way in shows how, and you can start free.