Script-first: why three quarters of my automation isn't AI
Translated from Russian. Read the Russian original.
When you're holding AI, everything around you starts to look like a job for AI. Move some files? Ask the model. Reformat a table? The model. Count how many tasks got closed this week? The model again.
Does it work? Sure. But it's slow, it costs money, and it comes out a little different every time. And in automation, "a little different" is a bug.
I have 43 scheduled jobs on my server. AI is involved in 10 of them. The other 33 are plain scripts that don't cost a single token. I call this principle script-first: script first, AI only where there's no way around it.
Three questions: script or AI
Before I automate a step, I ask myself three questions.
- Does the task have one correct answer you can check? How many days until the deadline, what week number it is, whether a file is in the folder. If yes, it's a script.
- Is the input structured rather than living text? A table, JSON, a list of files: script. A client email, a meeting transcript, a question in a chat: more likely AI.
- Will this repeat? A one-off is easier to hand to the model. Something that runs every day pays for the script within a week.
If at least two answers are "yes," I write a script. AI stays where you need to grasp meaning, write text, or make a decision.
Three levels of execution
Even within "AI" there are differences. I keep three levels:
| Level | What it does | Examples |
|---|---|---|
| Script | Mechanics with no variations | site build, task archiving, backups, link checks, calendar math |
| Fast model | Language without deep analysis | format a message, sort tasks by priority |
| Strong model | Thinking | code, incident analysis, weekly retro, article |
The rule for choosing is simple: the cheapest level where the result is still good. Using a strong model to format lists is like calling an architect to hang a shelf.
Trick 1. A watchdog script before the model
The most common money leak: an agent that wakes up on schedule, looks around, and says "no new tasks." Every one of those idle runs costs tokens.
The fix: put a tiny script in front of the model that checks in a fraction of a second whether there's any work. No work, and the model doesn't even start.
tasks = find_untranslated_posts() # plain code: compare files
if not tasks:
print('{"wakeAgent": false}') # agent sleeps, no tokens spent
else:
print(json.dumps(tasks)) # agent gets a ready-made to-do list
That's how this blog's translator works. Every hour, a script checks for posts without translations. The model wakes up only when I publish a new post, and it immediately gets an exact list: which file, which language, where to save it.
Trick 2. The script checks the AI
AI writes well but is bad at catching its own small mistakes. A script is the opposite.
In the city guide case study, the AI writer kept stubbornly leaving foreign terms untranslated and writing numbers that weren't in the sources. Asking didn't help. What helped was a three-hundred-line script: it finds foreign-alphabet words with no explanation, numbers with no footnote, and links to pages that don't exist. The agent runs it on its own and fixes the text until the check passes.
The model writes, the script checks. Each does what it's good at.
Trick 3. AI writes the script once
"But I'm not a programmer" is the most common objection. You don't need to be.
Ask the model not to do the task, but to write a script that will do it. You spend tokens on the code once, and after that it runs for free and the same way, even a thousand times. For example: "Write a Python script that takes all the files in the 'Invoices' folder, pulls the date and amount out of each file name, and puts them in a table." The model writes it in a minute, and you never have to ask it to do that by hand again.
That's exactly how scripts show up in my HQ: AI writes them, I test them on real data, and from then on the script runs by itself.
Trick 4. The third repeat is a script
If you're asking the model to do the same thing the same way for the third time, that's a signal. Not "the model has a bad memory," but "this belongs in a script."
A good example is the calendar. My agent took the week number and its start and end dates from the previous report instead of calculating them. A one-day error quietly slipped through five weekly reports in a row. Now a script calculates the week from the clock, and a daily check compares every report against it. Problem solved for good.
When a script is a bad idea
Script-first doesn't mean "script at any cost." The sign you've overdone it: rules start multiplying. If you're writing the hundredth condition like "if the text contains word X but not word Y" to sort client emails, stop. That's a job for the model: it understands living language better than any pile of conditions.
The line is wherever meaning is involved. Count, compare, move, check a format: script. Understand, phrase, decide: AI.
What to do today
Write down 5 repetitive tasks from your week that you already do with AI or by hand. Ask the three questions from the start of this post about each one.
Take the one that got three "yes" answers and ask the model: "Write a script that does this without me. Explain how to run it." Test it on real data. If it works, you've just removed one task from your week for good, and one line item from your AI bill.