DEV Community

ArkNet Digital
ArkNet Digital

Posted on Edited on

The Best Part Is No Part: Musk's Algorithm Applied to Software, Security and Your Cloud Bill

Every line of code you ship comes with a maintenance schedule. Every endpoint is attack surface, every scheduled job is a bill that recurs along with its failure mode, and every dependency is someone else's bug running in your production.

We all know this, and the software industry does the opposite anyway. We add features, flags, services, cron jobs and wrappers, and lately AI-generated code by the thousand lines. Then we point our best engineers at optimizing and automating things that probably shouldn't exist.

There's a well-known fix. I just don't see many teams apply it to software.

Musk's algorithm only works in order

Walter Isaacson's biography of Elon Musk describes the five-step "algorithm" Musk repeats at Tesla and SpaceX production meetings, by his own account "to an annoying degree" (excerpt). First, question every requirement, and attach to each one the name of the person who made it, never a department. In his words, "requirements from smart people are the most dangerous, because people are less likely to question them." Second, delete any part or process you can: "If you do not end up adding back at least 10% of them, then you didn't delete enough." Only third do you simplify and optimize, because "a common mistake is to simplify and optimize a part or a process that should not exist." Fourth, speed up the cycle time. Automation comes last. Musk is blunt about why: "The big mistake in Nevada and at Fremont was that I began by trying to automate every step."

The order is the point. In my view most engineering orgs run steps three to five with real enthusiasm and skip the first two entirely. You end up with fast, heavily automated processes that never should have existed.

AI coding agents make this worse in a very specific way. They make automation, the last step, almost free. When generating code costs nothing, the default drifts toward adding, and the algorithm is the counterweight.

I want to apply it to three places where the waste costs real money.

Attack surface is a parts count

Security people usually think in terms of controls. I find it more useful to count parts. Every route, table, credential, permission, open port and integration is a part, and any of them can fail open.

In September 2026, UpGuard published the largest study so far of Supabase misconfiguration. It found 16,326 databases exposing readable tables, and 55.8% of them showed signs of holding personal data (UpGuard Research; BleepingComputer). UpGuard points out that Supabase now turns on row-level security by default for tables created in its Table Editor. Tables created programmatically, "which is how coding agents interact with Supabase," don't get it by default.

Run the algorithm on that. Does every table in your public schema really need to be reachable from a browser holding the public key? Who decided that, by name? In most apps I'd bet nobody did. It's a default that nobody ever questioned. Supabase's own docs are unusually direct about the fix: on projects that still grant the anon and authenticated roles by default, revoke those grants, because "adding policies doesn't remove them" (Supabase RLS docs). The grant is the part. Deleting it is a stronger control than any policy you can stack on top.

-- Delete first: nothing is reachable until someone names why it should be.
revoke all on all tables in schema public from anon, authenticated;

-- Then add back, deliberately, the few paths that have a named owner.
grant select on public.products to anon;              -- owner: storefront (Michael)
grant select, insert on public.orders to authenticated;
alter table public.orders enable row level security;
create policy "own orders" on public.orders
  for select to authenticated
  using ((select auth.uid()) = user_id);
Enter fullscreen mode Exit fullscreen mode

That's the delete step, with the 10% add-back built in. Default-deny gets talked about like a philosophy. I think it's just the algorithm applied to permissions.

The same pattern shows up one layer higher. Vercel's classic Cron Jobs call your code with an HTTP GET to a public path, so every scheduled job doubles as an internet-facing endpoint you have to guard with a secret. On 5 November 2026, Vercel put Schedules into public beta, and Schedules can target a private function with no public URL, or a queue topic with retries (Vercel Schedules docs). That's the platform deleting a part on your behalf. An attacker can't call an endpoint that doesn't exist, and I'd take that over the cleverest auth check.

Polling is a part you pay for forever

Infrastructure bills are mostly the cost of parts nobody questioned. Think of the poller that checks for changes every few seconds, the worker that never sleeps, the second copy of a pipeline, or the dashboard query that runs on a timer for a dashboard no one opens.

Let me do the math with published prices instead of hand-waving. On Vercel's Fluid compute, Pro pricing starts at $0.128 per Active CPU hour and $0.60 per million invocations (Vercel pricing; Fluid compute pricing). Now take a pattern AI-generated front ends seem to love, where every open tab polls an API every 10 seconds to stay fresh. A thousand concurrent users at six polls a minute is 6,000 requests a minute, which over a 30-day month comes to 259.2 million invocations. The invocations alone run about $156. If each poll burns 20 ms of active CPU (that's my illustrative figure, so measure your own), you add roughly 1,440 CPU hours, or about $184.

So you're near $340 a month before memory, database reads or egress, and nearly all of those requests come back with "nothing changed." At 10,000 concurrent users it's over $3,000 a month to ask the same question 2.6 billion times.

Apply the steps in order and the fix is obvious. Does this view need to be fresh within 10 seconds, and who said so? Usually nobody did, or a requirement written for one screen got copied to all of them. Delete polling from every view where a minute of staleness is fine, which in most apps is most views. For the few that really need it, swap pull for push with database change events, a realtime channel or a webhook, so you pay when something changes and not when someone wonders. Cache what's left at the edge. Only then add autoscaling and cost alerts. The usual move is the reverse: a budget alert bolted onto a design that's wasteful by construction.

The cheapest code to maintain is code nobody generated

Coding agents are extraordinary at that last automation step. Ask for a feature and you get the feature, plus an abstraction layer, three utility files, a retry wrapper, a new dependency and tests for all of it. Each piece looks reasonable on its own, and together they're a lot of new parts.

So I'd run the algorithm on the diff, not just the product. Before prompting, write one sentence saying who needs this and why, and if you can't name the person, don't generate it. In review, make deletion an explicit question: what in this pull request could go with no change in behavior? New dependencies should need a named justification, and abstractions with a single caller can go. I'd also start watching net lines instead of lines written, because a week where the codebase shrank and the features grew is a very good week. And don't let an agent automate a workflow you haven't already run by hand and stripped down. Musk learned that with robots on a battery line. I suspect a lot of us will learn it with agents in CI.

Testing in production without being reckless

People admire SpaceX for how fast it iterates: build, test, learn, repeat. In software, speeding up the cycle only works if failure is cheap and contained, and the best tool for that is decades old and still underused. It's the error budget.

Google's SRE book treats reliability as a budget to spend, not a number to max out. "100% is the wrong reliability target for basically everything," and the gap between your target and 100% is room that releases can use (Google SRE book, Introduction; see also Embracing Risk). Combine that with feature flags, canaries and automatic rollback, and moving fast becomes arithmetic instead of a slogan.

Deletion helps here too. Fewer parts means a smaller blast radius per change, so you can afford to ship more changes. I'd go as far as saying deletion is what makes speed safe.

If I ran an engineering org, I'd hold a deletion review every quarter. Every public endpoint and scheduled job, every database grant, every polling loop, dependency, feature flag and service credential gets a named owner and a one-line reason to exist. Anything without an owner gets made private, revoked, slowed down, removed or narrowed. Then I'd hold the team to Musk's metric, because if you never have to add anything back, you didn't delete enough.

AI already made writing code fast. What I think matters now is having the discipline to delete faster than the AI can generate.

If your cloud bill or your attack surface grew faster than your product this year, I'm happy to go through a deletion review with you. What's the biggest thing you've deleted that nobody missed? Tell me in the comments.

Michael, ArkNet Digital (https://www.arknet.digital)

Top comments (0)