
Senior Full-Stack & AI Product Engineer | AI Agents & Agentic Workflows | TypeScript, React, Node.js | Products used by millions daily
Wroclaw, Poland
Joined October 2018
- Tweets102
- Following426
- Followers43
- Likes2K
I hadn't heard of Agent Substrate before reading Katelyn Lesse's article, so this morning I dug a bit deeper. Sharing some of my notes.
What it is
An open-source runtime from Google that runs AI agents on Kubernetes. You pay for compute only while an agent is actually working.
What problem it solves
A coding agent works in short bursts. It runs a step, then waits for the model to answer, for an API call or for you to review its work. Waiting can take 90 to 95% of a typical session.
While it waits, it uses no CPU, but you can't just shut it down. It still has a cloned repo, uncommitted edits and running processes in memory and on disk. Kubernetes was never built for that.
The usual setup on Kubernetes is one Pod per agent, which leaves two bad options. You can keep the Pod running all day so the agent answers fast, but then you pay for idle compute around the clock. Or you can scale it to zero, which is cheap, but waking it up means cloning the repo and reinstalling packages again. That takes more than 20 seconds.
Substrate separates the agent's state (memory and files) from the compute it runs on. That compute comes from a small shared pool of workers: sandboxes that are already started and ready to take any agent.
When a turn ends and the agent waits for your next message, Substrate saves a snapshot of its memory and files to storage and returns the worker to the pool.
When your message arrives, any free worker loads the snapshot, and the agent continues where it paused. There's no cloning or reinstalling, and it takes under half a second.
Live connections don't survive the snapshot, so the agent has to reconnect to its database or a remote MCP server after it wakes up.
software engineers are going to have to tackle a new set of problems to unlock powerful multiagent systems to solve the world's hardest problems - right now is one of the most interesting moments in history to be an engineer.
2
2
272
It's crazy how much my expectations have changed in just over a year. Today, if I can't connect a product to my AI assistant, it's a major drawback for me.
But I also realize that I'm living in an AI bubble. Andrej Karpathy recently pointed out how wide the gap in people's understanding of AI has become. By his rough estimates, 1–2 billion people are still occasional users of free AI chatbots.
Most people I talk to outside this bubble have never heard of AI connectors, so they don't look for them when choosing a product. Some even find a chat interface harder to use than a traditional UI.
If you're building a product today, I think it's important to keep your actual audience in mind. If you're targeting a broader audience, make your product accessible to AI assistants, but keep the familiar interfaces people already know how to use.
Technology moves fast, but people's habits take longer to change. Give them time.
1
99
A lot of things we already do on engineering teams work surprisingly well with coding agents. Retros are one of my favorites. A prompt to try is below.
I try my best to avoid doing the same type of work twice and to automate it with AI whenever possible. Maybe it's because I've followed the DRY principle for many years, since the days when dinosaurs walked the earth and programmers wrote code by hand. But because I run multiple sessions at once, quite often I just don't see which mistakes my agents keep repeating. A retro is a great opportunity to simplify the work and reduce token usage at the same time.
Here is a prompt to try it yourself:
----------
Review [this session / my sessions in this repo from the past week]. Focus on improving my AI workflow: the files, checks, docs and tools around the agent, not the code itself. For past sessions, find the logs your tool keeps on this machine; if you cannot read them, say so and review only this session. State which sessions you actually read in one short line.
Start with the previous report in retros/, if there is one. Check which of its fixes were actually applied and whether those mistakes came back. If an applied fix did not stop its mistake, the fix failed. Propose replacing it with a stronger fix using the order below.
Look for corrections I had to repeat; claims of "done" that a later check disproved; things you had to discover or I had to paste in; files you had to hunt for; existing checks that did not run; rules in my instruction files that change nothing; and expensive tool calls.
For each problem, quote the moment it happened. Drop anything you cannot trace to a quote. If an existing rule already covered it but nothing enforces it, count it as a repeat and propose the next stronger fix in the order below.
Choose fixes in this order. First, try to make the mistake impossible: remove the wrong option or give the agent one right way to do it, such as a script, a permission rule or one source of truth. If that is not possible, propose a check, such as a lint rule, test or hook, whose error tells the agent how to fix it. Use a written rule only for judgment calls. For each proposed check, show the real past mistake it would have caught.
Report at most three problems, the most severe first. Explain what caused each one and the fix you propose. Only propose fixes; change nothing until I pick what to apply, except for saving this report to retros/<date>.md so the next retro can review it. If nothing is worth fixing, say so.
----------
Would be happy to hear what you found and whether it improved your productivity :)
5
5
135
I remember the days when I'd spend entire nights in front of my computer, trying to figure out how to fix a bug. I'd dig through Stack Overflow threads, read blog posts, and see how other engineers had tackled similar problems, piecing together bits of information until I finally found a solution.
And that feeling when you finally got it working? Nothing else came close. It was a dopamine rush like no other.
I still remember that sweet feeling of cracking a tough problem. You'd go to bed, but your brain would keep running, thinking about how you could make the solution even better. And the next morning, you'd wake up and get right back to improving it.
These days, many of those problems can be solved by simply throwing more tokens at them or switching to a more capable model.
And honestly, that makes me both sad and excited.
On one hand, we're slowly losing something we genuinely loved about engineering.
On the other hand, we can finally focus more on what really matters.
We can take on more ambitious problems. Explore fields we never even imagined we'd be able to contribute to because the barrier to entry was just too high.
We can finally spend time thinking through every tiny detail of an application's business logic, every edge case, every interaction, until the experience feels incredible for the people using it.
We can build AI agent workflows that continuously improve our products, identify issues, and catch problems that previous generations of models missed.
We can start working at the intersection of software engineering and fundamental science, pushing boundaries and tackling problems that once seemed impossible to solve.
Writing code used to be the bottleneck for so much of this.
And I'm genuinely happy that more and more people can now build real, working software without knowing how to code. They can simply describe what they want and watch their ideas come to life.
I know this transition is going to be painful for many engineers. I get it. I feel some of that loss myself.
But I still believe it's worth it.
1
1
184
One of the main issues for engineers in 2026 is no longer how to write code with agents. It's how to verify it. The verification layer deserves the same attention as any other part of your product, because it boosts the whole team's productivity and cuts issues and rollbacks.
There's no perfect verification layer for agent-written code. Here are some of the building blocks you can use, in order of priority. Compose your own for your product.
1. Turn corrections into checks. When you correct the agent, first ask whether a tool can stop that mistake from happening again: a lint rule, a type, a test, a hook or a small script. A tool gives the same result every time. Fast checks like lint and types can run on every change, heavier ones like E2E tests after a phase of work, and almost all of them belong in CI. A line in AGENTS.md is the last resort: the agent may ignore it.
2. Checks on the running app. Green tests don't prove the feature works. Let the agent use the app like a user: Chrome DevTools MCP, Playwright MCP or Claude in Chrome for the web, a mobile MCP for iOS and Android, computer use for desktop. Wrap it in a skill and have the agent prove in the PR what it checked, with screenshots or video.
3. A safety net in production. Ship behind feature flags, invest in monitoring and A/B tests per feature, and automate the rollback, so a bad change is turned off without a deploy. Track your rollback rate: it shows how well your verification layer works.
4. An independent reviewer. A second agent reviews every change and tags findings Important, Nit or Pre-existing. A pre-existing bug that isn't critical goes into a separate PR. There's no single right setup: one well-tuned reviewer or several focused ones, blind rounds or rounds that build on earlier ones. It also depends on the model: a setup tuned for Claude may work differently with GPT. Experiment and keep it flexible: moving to Claude 5 meant reworking many skills and prompts.
5. A learning loop. Claude Code's auto memory already keeps your corrections. The ECC plugin goes further and turns them into "instincts" with a confidence score (turn on its observer first). Review them weekly and move the strongest into block 1.
6. Protect the checks. If the agent can edit a test or the CI file, it can make a check pass by weakening it. Deny those paths in its permissions and turn on the sandbox, because scripts can get around the rule.
7. Last but not least, keep the codebase clean. Easy to say, hard to follow. Agents copy the code around them, so one workaround becomes the pattern the next agent repeats. Put refactoring on a schedule with /loop or routines, like a daily run that removes one deprecated pattern or bad practice. Then turn it into a check from block 1, so it doesn't return.
✍ I write every week about AI agents in practice: tips & tricks and common traps. I try to explain them as simply as possible. Follow me so you don't miss the next post.
2
3
328
If you want to dive deeper into any of these blocks, here's what to read:
Lauren Tan, "All Code Is Slop (Except Mine)": youtube.com/watch?v=O_zcc6Xl…
Addy Osmani, "How the Claude Code team thinks about verification": teapawt.org/addyosmani/status/2122…
Claude Code hooks: code.claude.com/docs/en/hook…
pstack, which can generate a verification skill for your repo: github.com/cursor/plugins/tr…
LaunchDarkly guarded rollouts (automatic rollback): launchdarkly.com/docs/home/r…
Claude Code Code Review (Important / Nit / Pre-existing): code.claude.com/docs/en/code…
ECC instincts: github.com/affaan-m/ECC
Permission deny rules + sandbox: code.claude.com/docs/en/sand…
/loop: code.claude.com/docs/en/sche…
Routines: code.claude.com/docs/en/rout…
1
157
If you have Fable resets, they also cut your total weekly usage. Not fully, but significantly.
A reset gives back what you spent on Fable. Used 80% of your week (50% on Fable)? You're back at 30%.
Settings > Usage > Reset for free
2
2
131
How it works, from Anthropic: support.claude.com/en/articl…
1
55
Vlad Yefimenko retweeted
Every time we have a new model, I run the same simple prompt on all my projects:
"Read this entire project and find everything that’s broken, inconsistent, inefficient, or no longer needed. Fix what you’re sure about and list the rest for me to review."
highly recommend trying
"An Anthropic engineer gave Fable 5.2 an empty folder and the task of designing a prototype operating system.
It coordinated over 1,000 subagents for eight days. The result boots on a laptop, with drivers, file storage, windows, a login screen and an installer."
- Ok, the gap between people who use AI and people who don’t is getting even more dramatic.
Same between people who work in AI labs and people who don’t.
1
2
120
Switching providers in the Vercel AI SDK is one line of code. Your caching bill is not.
With OpenAI and Gemini, the same code caches by itself. With Claude, nothing is cached until you ask for it.
OpenAI and Gemini notice when a request starts like an earlier one and bill that repeated part at a discount.
On Claude you mark where the cached part ends. An agent calls the model once per step, and each call resends the whole conversation with every tool result so far. Without a marker, you pay full input price for all of it. For a 100,000-token conversation on Opus 5.5, that's $0.40 of input per step. From the cache, the same tokens cost $0.02, a twentieth of the price.
✔️ The fix is one option on the call: caching: 'auto' through Vercel's AI Gateway, or cacheControl with ai-sdk/anthropic. Both keep the cache marker at the end of the conversation for you. Anthropic calls the second one "automatic caching", but despite the name it's off until you send it. The exact code is in the first comment.
Message threads, a beta in Anthropic's API, sound like another fix: Anthropic keeps the conversation for a few minutes, so you send only the new messages and the first token arrives sooner. But the price is the same, and a thread doesn't cache by itself, so send the same cache option with every thread request.
⚠️ Where to pay attention:
→ In an agent or a chat, each request extends the previous one, so put the cache option on the generateText call. The marker then moves to the end of every request. If you put it only on the system prompt, everything after it costs full price on every step.
→ For one-off calls (the same long system prompt, a new question each time), do the opposite and put the marker on the system prompt. On the call, it would land on the question, which never repeats, so you'd pay for a cache write on every call and never read it.
→ Don't put dynamic values at the top of the system prompt, for example a timestamp. Any change at the start breaks caching on all three providers. On OpenAI and Claude the tool list counts as the start too, so don't change activeTools between steps.
💡 Before you ship a provider switch, look at cacheReadTokens on each step of an agent run. When caching works, the number goes up step after step, because each request reads everything before it from the cache. If it's zero, you're paying full price. If it stays the same, only the system prompt is cached.
✍ I write every week about AI agents in practice: tips & tricks and common traps. I try to explain them as simply as possible. Follow me so you don’t miss the next post.
6
6
332
The exact option, on the generateText / streamText call:
• Through Vercel's AI Gateway: providerOptions: { gateway: { caching: 'auto' } } (it places the cache markers for you)
• With the AI SDK's Anthropic provider (ai-sdk/anthropic) 3.0.47 or newer: providerOptions: { anthropic: { cacheControl: { type: 'ephemeral' } } } (Anthropic's automatic caching, for agents and chats; for one-off calls that share a system prompt, put cacheControl on the system message instead)
The second one is in that package's changelog, not yet on its docs page: github.com/vercel/ai/blob/ma…
Docs behind the post:
• Vercel AI Gateway, automatic caching: vercel.com/docs/ai-gateway/m…
• AI SDK, Anthropic provider: ai-sdk.dev/providers/ai-sdk-…
• Anthropic prompt caching: platform.claude.com/docs/en/…
• Anthropic message threads (beta): platform.claude.com/docs/en/…
• OpenAI prompt caching: developers.openai.com/api/do…
• Gemini caching: aistudio.google.com/docs/cac…
I left out other providers, like DeepSeek or Qwen: they have their own caching rules.
1
86
Yesterday I decided to give the Claude desktop app another try. Usually I prefer to use the Claude CLI.
Didn’t expect that they shipped so many features to the Claude app, and now it doesn’t feel like a trial version of the Claude CLI.
1
2
77
Claude Code now compacts your conversation while you're away.
Since v2.1.299 (October 14), a conversation over 200K tokens that sits idle for about 54 minutes gets summarized before its one-hour prompt cache expires. When you come back, you see "Compacted while idle", and the model works from that summary instead of your full history.
The reason is cost. Once the cache expires, your next message makes Claude Code re-send the whole conversation without the cache, which is slower and costs more.
Honestly, I hate automatic compaction of any kind. I'd rather spend some extra usage than lose details I still need, and I want to decide myself when compaction happens. So I turn it all off with one setting:
"autoCompactEnabled": false in ~/.claude/settings.json (or /config → Auto-compact → off)
I run /compact myself at natural breaks. A small tip if you don't know it: the strategic-compact skill from ECC (Everything Claude Code). Its hook reminds you once the context grows, and its guide lists the best moments to compact: after research, after the plan is written to a file, after debugging, never mid-implementation. I highly recommend checking it, at least for the ideas. I find them quite useful.
Kudos to @affaan for creating ECC.
The strategic-compact skill from ECC: github.com/affaan-m/ECC/blob…
Claude Code docs on idle compaction and the auto-compact setting: code.claude.com/docs/en/sett…
1
74
Have you seen a non-technical founder actually make money with a vibe-coded product?
Not a demo or a waitlist. Paying customers.
The successful vibe-coded products I know are all run by people with at least some technical background.
8
1
190
When Claude Code searches or fetches the web, Claude almost never reads the page itself. It reads what another model wrote about it.
A model can't run anything. To "call a tool", Claude writes a small request like {"name": "WebSearch", "input": {"query": "..."}} and stops. Something else runs it and returns the result, then Claude picks the next step. That cycle is the agent loop, and whatever runs the tool decides what Claude sees.
I followed one tool call from a real run: I asked Claude Code 2.1.316 whether a demo repo is affected by the Mini Shai-Hulud npm worm (its lockfile pins two of the worm's May versions). Claude wanted to check two articles, so its reply held two tool calls at once. Here's one:
{"name": "WebFetch", "input": {"url": "thecybersecguru.com/…", "prompt": "Quote verbatim the affected versions listed for echarts-for-react, timeago.js, and lodash…"}}
Look at the prompt field: Claude writes the question a second model will answer. Then Claude's turn ends.
Claude Code, the harness, checks my permissions and downloads this page: 252 KB of HTML. It converts it to Markdown and keeps at most 100,000 characters. For a longer page, the tool result tells Claude how much went unread. This one fit.
Then it sends that Markdown and Claude's question to a second model. I had Opus 5.5 selected, but the reading went to a cheaper model. The docs don't say which; my run's usage report shows Claude Haiku 5.5. Its answer was 1,597 characters, with the key line: the article "doesn't mention echarts-for-react, timeago.js, or lodash". For the whole run (5 pages, 2 searches), Haiku's bill was $0.03 at API prices. Opus, doing the main work, cost $0.61.
Claude Code ran both fetches at the same time, then sent a new request: the whole conversation plus both answers, 56,409 tokens. The API keeps no memory, so Claude Code resends the whole conversation each time.
Now Claude, the main model, reads the answer, not the page. If Haiku had missed a line, Claude couldn't tell. The docs list this as a prompt-injection safeguard. I think it's first of all about context and cost: the page itself never goes into the expensive model's context.
I checked that article myself: Haiku was right, it says nothing about these packages (it covers the worm's May 11 wave). The second article listed both versions, so Claude's verdict was right: the repo is affected.
So a harness like Claude Code is a multi-model system. In my run, Opus planned and Haiku read the pages. Not every step runs on the model you picked.
For an experiment, I pointed Claude Code's Haiku setting at Opus (ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-opus-5-5) and asked the same question again. Now Opus read the pages too, but the main Opus still got only the short answers, never the pages.
Same verdict both times: affected. Only the bill changed: $0.64 with Haiku reading ($0.61 + $0.03), $1.35 with Opus, at API prices.
Next post: prompt caching. Follow me so you don't miss it.
9
8
587
Sources:
• WebFetch: Markdown conversion, the 100,000-character limit, a separate model call for most fetches: code.claude.com/docs/en/tool…
• Web page summaries as a prompt-injection safeguard: code.claude.com/docs/en/secu…
• ANTHROPIC_DEFAULT_HAIKU_MODEL: code.claude.com/docs/en/mode…
• The Messages API is stateless: platform.claude.com/docs/en/…
• How tool use works: platform.claude.com/docs/en/…
Sizes, tokens and costs are from my own run of Claude Code 2.1.316.
3
97
Claude Code can delete a file that /rewind cannot bring back.
If Claude only touched that file through Bash, it isn't tracked for rewind. An rm command can delete it without leaving a checkpoint to restore.
But if Claude had already edited that file through its file-editing tools, subsequent Bash changes can be restored too.
The difference comes from what the harness tracked.
Here's how tool calling works underneath.
The model receives tool definitions: names, descriptions, and input schemas. It generates a structured request describing which tool to use and what to do.
The Claude Code process checks permissions, executes the allowed action, and returns the result.
The model receives that result and chooses its next step.
That surrounding software is the agent harness. It handles execution, manages the context the model receives, and tracks changes for features like /rewind.
If you've used Redux DevTools, the idea is familiar: time travel restores store state, but it doesn't undo an HTTP request or a localStorage write. Claude Code has its own boundary: /rewind restores tracked files. Changes made only through Bash fall outside that boundary.
Background subagents have a similar limit. Rewind restores files already tracked through the main session's file-editing tools. Files touched only by the background subagent stay changed.
This matters for any agent you build. A tool call might make a booking, issue a refund, or email a customer. Agree with the business on what can run automatically, what needs a person's approval, and what you must be able to undo. Keep a record of what happened so you can investigate when something goes wrong.
So for every tool that changes something, I want three answers:
→ What happened? Return enough detail to check the result.
→ What happens if it runs again? A retry should not create a second booking or issue another refund.
→ If something goes wrong, how do we recover? Define what can be undone and when a person needs to step in.
#AIAgents #AIEngineering
5
3
218










