﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>The cost of a free feature</title><description>&lt;p&gt;About twenty years ago, I was working on what would eventually become RavenDB, and I needed an engine to handle queries. Writing a query engine from scratch is its own &lt;em&gt;very&lt;/em&gt;&amp;nbsp;large project, quite separate from writing a database engine. I made a decision that I still consider one of the smartest I made in those early days: I built on top of Lucene as my indexing and query engine.&lt;/p&gt;&lt;p&gt;That let me stand on a firm foundation while I dealt with the problems I actually cared about: building a NoSQL solution that didn&amp;#39;t feel like juggling knives. Lucene gave me a mature, battle-tested way to index and query data, and I got to spend my time on the parts that made RavenDB &lt;em&gt;RavenDB&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;It was a good decision. But like a lot of good decisions, it came with a bill attached, and the bill arrived about a decade later.&lt;/p&gt;&lt;h2&gt;Making use of features that are already there&amp;hellip;&lt;/h2&gt;&lt;p&gt;Here is a query that every developer has written a thousand times: &lt;em&gt;give me the ten most recent posts on my blog.&lt;/em&gt;&amp;nbsp;You write those sorts of queries in every kind of application you write, after all. And there is the natural follow-up:&lt;em&gt;&amp;nbsp;tell me the total number of posts, so I can render the pagination.&lt;/em&gt;&lt;/p&gt;&lt;p&gt;In most databases, you need to make two separate queries for this, and those two queries usually mean two separate database roundtrips. One to fetch the page, one to count the total.&lt;/p&gt;&lt;p&gt;In RavenDB, it&amp;#39;s one query. You ask for the page, and you get the total count back in the same response.&lt;/p&gt;&lt;p&gt;This &lt;em&gt;matters&lt;/em&gt;&amp;nbsp;a lot more than you may initially think. In most systems, the cost of the network round-trip to the database dwarfs the cost of the query itself. The query runs in microseconds; the round-trip is the &lt;em&gt;expensive&lt;/em&gt;&amp;nbsp;part. So folding the count into the same response that carries the results eliminates an entire round-trip. When you run a paged query in RavenDB, you get the total number of matching results for free, and that is genuinely a wonderful feature.&lt;/p&gt;&lt;p&gt;The important word in that paragraph is &lt;em&gt;free&lt;/em&gt;. I did not design this feature. I did not sit down and decide that paged queries should return a total count. Lucene already computed it, for reasons of its own, as a side effect of how it processes a query. I got it for nothing, exposed it through the API, and it became one of those small touches that made RavenDB pleasant to use and made your application run faster.&lt;/p&gt;&lt;p&gt;A free feature that adds real value, give me more of that! &lt;/p&gt;&lt;h2&gt;Fifteen years later&lt;/h2&gt;&lt;p&gt;Imagine a time skip of a decade and a half: we start building Corax, the next-generation query engine for RavenDB. Remember when I said that building a querying engine is a &lt;em&gt;Big Project?&lt;/em&gt;&amp;nbsp;I meant it. &lt;/p&gt;&lt;p&gt;It turns out that most databases do not give you the total result count for free for a very good reason: &lt;strong&gt;It isn&amp;#39;t free.&lt;/strong&gt;&amp;nbsp;Consider the following queries and their internal representation in the database:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-php'&gt;&lt;code class='line-numbers language-php'&gt;from Posts 
where IsPublished &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token constant boolean"&gt;true&lt;/span&gt;
limit &lt;span class="token number"&gt;10&lt;/span&gt;


from Posts
where IsPublished &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token constant boolean"&gt;true&lt;/span&gt; &lt;span class="token keyword"&gt;and&lt;/span&gt; PublishedAt &lt;span class="token operator"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="token variable"&gt;$today&lt;/span&gt;
limit &lt;span class="token number"&gt;10&lt;/span&gt;


from Posts
where IsPublished &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token constant boolean"&gt;true&lt;/span&gt; &lt;span class="token keyword"&gt;and&lt;/span&gt; PublishedAt &lt;span class="token operator"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="token variable"&gt;$today&lt;/span&gt; &lt;span class="token keyword"&gt;and&lt;/span&gt; Tags &lt;span class="token function"&gt;in&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token variable"&gt;$tags&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
limit &lt;span class="token number"&gt;10&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;It is easy enough to check the number of posts that are published. A range query on a date field is more complex, especially if you have a lot of posts. Getting the total number of posts in a set of tags is more complex, since a post can have multiple tags and you need to deduplicate.&lt;/p&gt;&lt;p&gt;The intersection of three clauses, of course, is distinct from the count of each.&lt;/p&gt;&lt;p&gt;The queries above can &lt;em&gt;stop&lt;/em&gt;&amp;nbsp;further processing once they have 10 results, after all. But when you need an &lt;em&gt;exact&lt;/em&gt;&amp;nbsp;count for the query, you need to actually evaluate it.&lt;/p&gt;&lt;p&gt;Lucene happens to produce it as a byproduct of its execution model, but in the general case, computing the total number of results for a query can be enormously expensive. &lt;/p&gt;&lt;p&gt;Imagine a physical phone book, and I ask you to get me the first ten people whose family name is Smith. You flip to the S section, find Smith, read off the first ten entries, and hand them back. Notice what you &lt;em&gt;didn&amp;#39;t&lt;/em&gt;&amp;nbsp;do: you never counted how many Smiths there are. &lt;/p&gt;&lt;p&gt;Now I ask you for the &lt;em&gt;total number&lt;/em&gt;&amp;nbsp;of Smiths. Suddenly, you have to go through every single Smith in the book and tally them. Smith is a common name. The cost of counting all of them can be far higher than the cost of just grabbing the first ten.&lt;/p&gt;&lt;p&gt;If you want a count, you have to actually &lt;em&gt;count&lt;/em&gt;, which means touching every matching result, even the ones you&amp;#39;re about to throw away. For large queries, getting the count can be the most expensive part of the query.&lt;/p&gt;&lt;p&gt;The feature is still meaningful, to be clear. There are plenty of cases where you genuinely need the total so you can build proper pagination. And in those cases, going to the database twice and paying for two network round-trips is wildly wasteful, so bundling the count in is exactly the right thing to do.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;How would I design this today? &lt;/p&gt;&lt;p&gt;I would approach this very differently. You often don&amp;rsquo;t need an &lt;em&gt;exact&lt;/em&gt;&amp;nbsp;count; you just need to show &lt;em&gt;something&lt;/em&gt;&amp;nbsp;so the application can render the paging controls and maybe show a rough count to the user. &lt;/p&gt;&lt;p&gt;I would probably expose an &lt;code&gt;EstimatedCount &lt;/code&gt;property for the queries, which is cheap, as well as a way to ask for an exact count in a single roundtrip. The key is that we would be clear in the contract that this is an estimation only.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;But because this was a basic, baked-in behavior of RavenDB, something we&amp;#39;d done &amp;quot;for free&amp;quot; from day one, Corax inherited an expectation that it had to provide an &lt;em&gt;exact&lt;/em&gt;&amp;nbsp;count. We were doing work on every query, only to end up discarding the result of that work, because the original engine had made it cost nothing, and so everyone assumed it cost nothing.&lt;/p&gt;&lt;h2&gt;How we dealt with it&lt;/h2&gt;&lt;p&gt;We solved this with a combination of approaches.&lt;/p&gt;&lt;p&gt;First, it turns out you don&amp;#39;t always need the count. Since the count is requested through the API, we made it explicit: the client can say &amp;quot;I care about the total count&amp;quot; or &amp;quot;I don&amp;#39;t care about the total count.&amp;quot; When the client opts out, we get to skip all that work. That alone recovers a lot of wasted effort.&lt;/p&gt;&lt;p&gt;Second, queries in RavenDB request the count far more often than they do in other databases, precisely &lt;em&gt;because&lt;/em&gt;&amp;nbsp;it used to be free. Years of RavenDB code were written assuming the count was always there, so there was enormous pressure to make counting itself fast rather than just optional. We did a significant amount of work to optimize how counting happens.&lt;/p&gt;&lt;p&gt;And this turns out to be a genuinely deep area. There is a whole body of research on how to count query results with as little work as possible. People have earned PhDs on this problem. What looked, from the application developer&amp;#39;s seat, like a single integer that just shows up in the response is an entire field of study once you&amp;#39;re the one who has to produce it.&lt;/p&gt;&lt;h2&gt;Hyrum&amp;#39;s Law sends its regards&lt;/h2&gt;&lt;p&gt;There&amp;#39;s a principle called &lt;a href="https://www.hyrumslaw.com/"&gt;Hyrum&amp;#39;s Law&lt;/a&gt;&amp;nbsp;that captures exactly what happened here:&lt;/p&gt;&lt;p&gt;With a sufficient number of users of an API, it does not matter what you promise in the contract: all observable behaviors of your system will be depended on by somebody.&lt;/p&gt;&lt;h2&gt;The actual lesson&lt;/h2&gt;&lt;p&gt;When you get something for free from a dependency, you are not just accepting a feature. You are accepting an obligation. The behavior becomes observable, the observable becomes relied upon, and the relied-upon becomes a promise you have to keep, possibly long after the dependency that gave it to you is gone.&lt;/p&gt;&lt;p&gt;The real price of a dependency is the behavior that you need to carry forward down the line, because it became part of your contract and your users rely on it. And &lt;em&gt;that&lt;/em&gt;&amp;nbsp;requires very careful consideration.&lt;/p&gt;&lt;p&gt;I want to be careful here, because the lesson is not &amp;quot;don&amp;#39;t take free things&amp;quot; or &amp;quot;don&amp;#39;t depend on Lucene.&amp;quot; Building on Lucene was the right call, and exposing the count was the right call. I&amp;#39;d probably make both decisions again (although I would weaken the promise about the accuracy of the count).&lt;/p&gt;&lt;p&gt;To be more accurate, I don&amp;rsquo;t think that the person who took that dependency twenty years ago was even able to properly understand the impact of that feature or its future complications. On the other hand, that &lt;em&gt;specific &lt;/em&gt;feature was something that I frequently demoed, and it always got a great reaction. This touched a &lt;em&gt;pain point&lt;/em&gt;&amp;nbsp;that many people had.&lt;/p&gt;&lt;p&gt;Hyrum wins again &amp;#128578;.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/204069-a/the-cost-of-a-free-feature?Key=c3ed237c-4a8c-41a0-8760-dc0cd139c034</link><guid>http://ayende.com/204069-a/the-cost-of-a-free-feature?Key=c3ed237c-4a8c-41a0-8760-dc0cd139c034</guid><pubDate>Fri, 10 Jul 2026 12:00:00 GMT</pubDate></item><item><title>Multi-Agents in RavenDB</title><description>&lt;p&gt;I&amp;#39;ve &lt;a href="https://ayende.com/blog/203974-a/the-gpu-is-the-new-bangalore"&gt;written before&lt;/a&gt;&amp;nbsp;about why I think the &amp;ldquo;modern&amp;rdquo; approach of solving every problem by adding agents is a doomed path. The current instinct is to add more layers of agents, judges, reviewers, etc. - and hope the model will be smart enough to do the right thing and actually get something done.&lt;/p&gt;&lt;p&gt;The issue is that we already have a well-understood way to coordinate independent contributors working on a complex system. It&amp;#39;s called software &lt;em&gt;design &amp;amp; architecture&lt;/em&gt;, and we&amp;#39;ve been refining it for decades. The instinct to solve a coordination problem by adding a smarter message bus between your agents is exactly backwards.&lt;/p&gt;&lt;p&gt;When talking about multi-agent support in RavenDB, I want to be clear about what we did &lt;em&gt;not&lt;/em&gt;&amp;nbsp;build. We didn&amp;#39;t build an orchestration framework. We didn&amp;#39;t build a swarm. What we built is much more boring, and I mean that as the highest compliment I know how to give.&lt;/p&gt;&lt;p&gt;We built a way for you to &lt;em&gt;solve&lt;/em&gt;&amp;nbsp;problems in a predictable manner and without a lot of hassle. &lt;/p&gt;&lt;p&gt;If you haven&amp;#39;t looked at &lt;a href="https://ravendb.net/articles/practical-look-at-ai-agents-with-ravendb"&gt;RavenDB&amp;#39;s AI Agents&lt;/a&gt;&amp;nbsp;yet, the short version is this: an agent is a system prompt, a connection to an LLM, and a set of &lt;em&gt;Query&lt;/em&gt;&amp;nbsp;tools, which let the agent read specific data through RQL you define, and &lt;em&gt;Action&lt;/em&gt;&amp;nbsp;tools, which let it do something in your application, but only through the specific doors you&amp;#39;ve opened.&lt;/p&gt;&lt;p&gt;The note on &amp;ldquo;specific&amp;rdquo; is the whole point. Instead of giving the model the freedom to access any data it wants and execute anything it feels like, we place careful guardrails that it cannot escape. &lt;/p&gt;&lt;p&gt;The agent can only pull the levers you gave it, using the data you explicitly handed it. The database takes care of the tedious, error-prone plumbing (such as conversation state, message history, talking to the model provider, etc.) and stores every conversation as a real document in the &lt;code&gt;@conversations&lt;/code&gt;&amp;nbsp;collection. You define &lt;em&gt;capabilities&lt;/em&gt;, and RavenDB takes care of all the rest.&lt;/p&gt;&lt;h2&gt;Where one agent starts to hurt&lt;/h2&gt;&lt;p&gt;A single agent like this will take you a genuinely long way. Right up until it doesn&amp;#39;t. The issue is the slow creep of complexity. Let&amp;rsquo;s say that you start with a simple agent to deal with answering employee questions in the context of the HR department.&lt;/p&gt;&lt;p&gt;The next feature is to assist them in filing expense reports. Then someone wants it to handle time-off requests, and then to look up the org chart, and six months later you have one prompt trying to be an entire company, with thirty tools competing for the model&amp;#39;s attention and a context window stuffed with things that have nothing to do with the question being asked.&lt;/p&gt;&lt;p&gt;That situation is problematic on multiple levels:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Your context window is full of a huge prompt (usually not relevant to the task at hand), a lot of tool descriptions and capabilities meant to cover every possible scenario under the sun.&lt;/li&gt;&lt;li&gt;Users&amp;rsquo; questions are either squeezed into the remaining context window or you have to move to models with larger context windows, which also cost more.&lt;/li&gt;&lt;li&gt;You are also stuck with a single model for &lt;em&gt;everything&lt;/em&gt;, instead of being able to pick the right model for each scenario. You overpay to run trivial chit-chat on your best model, or you cripple the hard tasks by forcing them onto a cheap one.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;This is not a new problem. Scope is how you manage complexity, and it works exactly the same whether the thing on the other end is a compiler or a language model.&lt;/p&gt;&lt;h2&gt;Multi-agents are just agents that talk to each other&lt;/h2&gt;&lt;p&gt;A multi-agent system in RavenDB is not a special kind of agent. It&amp;#39;s several ordinary agents, each built exactly the way you already know how to build one, where one of them happens to know that another exists and can hand work to it.&lt;/p&gt;&lt;p&gt;The way you connect them is almost anticlimactic. You add a &lt;code&gt;SubAgents&lt;/code&gt;&amp;nbsp;entry to the parent agent: an identifier and a description. That&amp;#39;s the entire wiring job. The description matters because that&amp;#39;s what the parent reads to decide whether a given request belongs to the specialist. There is no router you write, no dispatch table, no orchestration layer. &lt;/p&gt;&lt;p&gt;You made the subagent available to the root, and RavenDB will invoke it for you when it is needed. RavenDB will also handle all the logistical minutiae needed to accomplish this successfully.&lt;/p&gt;&lt;p&gt;Those include ensuring that the scope for the root agent is shared with the called subagents, managing memory and conversation history, allowing the &lt;em&gt;subagent&lt;/em&gt;&amp;nbsp;to invoke its own queries and actions, etc. &lt;/p&gt;&lt;p&gt;We ship a demo for this &amp;mdash; an HR chatbot, &lt;a href="https://github.com/ravendb/samples-hr"&gt;samples-hr on GitHub&lt;/a&gt;&amp;nbsp;if you want to run it yourself. An employee comes back from a conference, uploads the receipt, and types &amp;quot;submit this expense.&amp;quot; From their side, it&amp;#39;s one smooth conversation.&lt;/p&gt;&lt;p&gt;Behind the scenes, it&amp;#39;s two agents. The &lt;strong&gt;HR Assistant&lt;/strong&gt;&amp;nbsp;faces the user and handles benefits, policies, and general questions. It does not know the first thing about filing an expense. What it &lt;em&gt;does&lt;/em&gt;&amp;nbsp;know is that there&amp;#39;s an &lt;strong&gt;Expense Manager&lt;/strong&gt;&amp;nbsp;specialist, and &amp;mdash; from that one-line description &amp;mdash; that receipts belong to it. It hands the task over, the specialist analyzes the receipt and creates the &lt;code&gt;BusinessTripBills&lt;/code&gt;&amp;nbsp;document, and the answer flows back up.&lt;/p&gt;&lt;p&gt;Go look in the database afterward and you&amp;#39;ll find two conversation documents, not one &amp;mdash; the HR Manager&amp;#39;s log and the Expense Manager&amp;#39;s log, each with its own scoped history. That&amp;#39;s not an implementation detail I&amp;#39;m mentioning for trivia&amp;#39;s sake. It means you can open either conversation and see exactly what that agent received and how it responded. The audit trail falls out of the design for free.&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the parent agent, trimmed down to the part that matters:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-dart'&gt;&lt;code class='line-numbers language-dart'&gt;public &lt;span class="token keyword"&gt;static&lt;/span&gt; &lt;span class="token class-name"&gt;Task&lt;/span&gt; &lt;span class="token class-name"&gt;Create&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token class-name"&gt;IDocumentStore&lt;/span&gt; store&lt;span class="token punctuation"&gt;)&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
 &lt;span class="token keyword"&gt;return&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;store&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;AI.CreateAgentAsync&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;
  &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;AiAgentConfiguration&lt;/span&gt;
  &lt;span class="token punctuation"&gt;{&lt;/span&gt;
   &lt;span class="token class-name"&gt;Name&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"HR Assistant"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
   &lt;span class="token class-name"&gt;Identifier&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;AgentIdentifier&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
   &lt;span class="token class-name"&gt;ConnectionStringName&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;ConnectionStringName&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
   &lt;span class="token class-name"&gt;SystemPrompt&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; @"&lt;span class="token class-name"&gt;You&lt;/span&gt; are an HR &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;assistant&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;
Provide&lt;/span&gt; info &lt;span class="token keyword"&gt;on&lt;/span&gt; benefits&lt;span class="token punctuation"&gt;,&lt;/span&gt; policies&lt;span class="token punctuation"&gt;,&lt;/span&gt; and &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;departments&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;
Do&lt;/span&gt; not suggest actions that are not explicitly allowed by the tools available to &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;you&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;
Do&lt;/span&gt; NOT discuss non&lt;span class="token operator"&gt;-&lt;/span&gt;HR &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;topics&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt; Answer&lt;/span&gt; only &lt;span class="token keyword"&gt;for&lt;/span&gt; the current employee&lt;span class="token punctuation"&gt;.&lt;/span&gt;"&lt;span class="token punctuation"&gt;,&lt;/span&gt;


   &lt;span class="token class-name"&gt;Parameters&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;
   &lt;span class="token punctuation"&gt;[&lt;/span&gt;
    &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;AiAgentParameter&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token class-name"&gt;EmployeeIdParameter&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
     &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"Employee ID; answer only for this employee"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
   &lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;


   &lt;span class="token comment"&gt;// The HR agent has no idea how to file an expense.&lt;/span&gt;
   &lt;span class="token comment"&gt;// It just knows a specialist exists, and when to call it.&lt;/span&gt;
   &lt;span class="token class-name"&gt;SubAgents&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;
   &lt;span class="token punctuation"&gt;[&lt;/span&gt;
    &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;AiAgentToolSubAgent&lt;/span&gt;
    &lt;span class="token punctuation"&gt;{&lt;/span&gt;
     &lt;span class="token class-name"&gt;Identifier&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;ExpenseAgentIdentifier&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
     &lt;span class="token class-name"&gt;Description&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"Manages business trip expenses: analyzing "&lt;/span&gt;&lt;/span&gt; &lt;span class="token operator"&gt;+&lt;/span&gt;
      &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"receipts/bills, reporting expenses, and retrieving "&lt;/span&gt;&lt;/span&gt; &lt;span class="token operator"&gt;+&lt;/span&gt;
      &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"monthly expense summaries."&lt;/span&gt;&lt;/span&gt;
    &lt;span class="token punctuation"&gt;}&lt;/span&gt;
   &lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;


   &lt;span class="token comment"&gt;// Its own capabilities cover only HR concerns.&lt;/span&gt;
   &lt;span class="token class-name"&gt;Queries&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;
   &lt;span class="token punctuation"&gt;[&lt;/span&gt;
    &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;AiAgentToolQuery&lt;/span&gt;
    &lt;span class="token punctuation"&gt;{&lt;/span&gt;
     &lt;span class="token class-name"&gt;Name&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"GetEmployeeInfo"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
     &lt;span class="token class-name"&gt;Description&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"Retrieve employee details"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
     &lt;span class="token class-name"&gt;Query&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; $&lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"from Employees where id() = &lt;/span&gt;&lt;span class="token interpolation"&gt;&lt;span class="token punctuation"&gt;${&lt;/span&gt;&lt;span class="token expression"&gt;&lt;span class="token class-name"&gt;EmployeeIdParameter&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="token string"&gt;"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
     &lt;span class="token class-name"&gt;ParametersSampleObject&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"{}"&lt;/span&gt;&lt;/span&gt;
    &lt;span class="token punctuation"&gt;}&lt;/span&gt;
   &lt;span class="token punctuation"&gt;]&lt;/span&gt;
  &lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;The Expense Manager, for its part, is defined in exactly the &lt;em&gt;same way&lt;/em&gt;&amp;nbsp;as any other agent. There is nothing special about it. It&amp;#39;s a normal agent that happens to be pointed at by a SubAgents&amp;nbsp;entry. &lt;/p&gt;&lt;p&gt;Notice what this buys you. The HR agent never sees the finance tooling. It doesn&amp;#39;t integrate the expense system, doesn&amp;#39;t swallow that domain, or deal with a BusinessTripBills&amp;nbsp;document. It shells the call out to the specialist and stays in its lane. If tomorrow finance wants their own policy-checking agent in the loop, you add another SubAgents&amp;nbsp;entry to the Expense Manager and the HR agent is none the wiser. Each piece keeps a small &amp;amp; independent scope. &lt;/p&gt;&lt;p&gt;Each of those agents is isolated from the others, so we can have the HR Agent use a pure textual model, maybe with high levels of reasoning. The Expense Manager agent, on the other hand, needs to be multimodal (to be able to read receipt images), but it doesn&amp;rsquo;t need to be smart. You can customize each for its own needs, without having to find the lowest common denominator.&lt;/p&gt;&lt;p&gt;The fact that each of those agents (even if they both participate in the same conversation) will use separate &lt;code&gt;@conversations&lt;/code&gt;&amp;nbsp;documents also means their contexts are isolated from one another. The fact that you just pushed the entire set of receipts from a two-week business trip to the Expense Manager agent doesn&amp;rsquo;t weigh down the HR agent when you ask about your remaining holiday balance.&lt;/p&gt;&lt;h2&gt;When you should not do this&lt;/h2&gt;&lt;p&gt;This shouldn&amp;rsquo;t be your default architecture. Like any advanced technique, you need a sufficient level of complexity to justify it. If the work fits in one sentence, it probably fits in one agent.&lt;/p&gt;&lt;p&gt;Answering from a knowledge base, generating a document from a template, running a linear sequence with no branching &amp;mdash; a single well-built agent handles all of that, and reaching for sub-agents just to keep things tidy or to mirror your org chart is perfectionism. It&amp;#39;s the same mistake as premature abstraction, and it costs you real latency and real tokens for the privilege.&lt;/p&gt;&lt;p&gt;Multi-agents earn their keep when one of the following is true:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;You need to independently develop the agents (different teams are handling different agents).&lt;/li&gt;&lt;li&gt;You will use different models for different parts of the system.&lt;/li&gt;&lt;li&gt;You want to explicitly limit the sharing of context between different parts of the system. &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;For example, keeping with the HR agent theme, let&amp;rsquo;s say that we want to allow users to ask questions about our policies (&lt;a href="https://ayende.com/blog/203430-c/using-multi-staged-actions-with-ai-agents-to-reduce-costs-time/"&gt;an example of such an agent&lt;/a&gt;). The problem here is that we may have a &lt;em&gt;lot &lt;/em&gt;of policies, and even when we limit ourselves to the right one, that is a &lt;em&gt;lot&lt;/em&gt;&amp;nbsp;of text. &lt;/p&gt;&lt;p&gt;Shoving all of the work of finding the right policy and extracting the specific elements to match the user&amp;rsquo;s question into an isolated agent can &lt;em&gt;massively&lt;/em&gt;&amp;nbsp;reduce the number of tokens that your agents will burn. &lt;/p&gt;&lt;h2&gt;Summary&lt;/h2&gt;&lt;p&gt;RavenDB&amp;rsquo;s multi-agents aren&amp;rsquo;t about orchestrating a robot army or an independent swarm of self-coordinating agents. It is far more prosaic than that. You&amp;#39;re composing independent components with clear boundaries and letting each one own a scoped conversation, its own tools, and the model that fits its job.&lt;/p&gt;&lt;p&gt;That&amp;#39;s not a new idea we invented for the age of AI. It&amp;rsquo;s bringing back the notion of independent components that are greater than the sum of their parts, in a way that is manageable, consistent, and hassle-free.&lt;/p&gt;&lt;p&gt;If you want to try it, grab a &lt;a href="https://ravendb.net/dev"&gt;free Developer license&lt;/a&gt;&amp;nbsp;or spin up a &lt;a href="https://ravendb.net/cloud"&gt;free Cloud database&lt;/a&gt;, and the &lt;a href="https://docs.ravendb.net/guides/multi-agents"&gt;multi-agent guide&lt;/a&gt;&amp;nbsp;walks through the demo end to end.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/204068-a/multi-agents-in-ravendb?Key=161fe52a-a127-4955-b8aa-0d1d75f7b5b1</link><guid>http://ayende.com/204068-a/multi-agents-in-ravendb?Key=161fe52a-a127-4955-b8aa-0d1d75f7b5b1</guid><pubDate>Tue, 07 Jul 2026 12:00:00 GMT</pubDate></item><item><title>The best code is the one you shift+delete</title><description>&lt;p&gt;Everyone talking about coding models fixates on the same number: how fast the thing generates code. This misses the point by a lot. The story isn&amp;#39;t about how fast the model writes code I would have written anyway. &lt;/p&gt;&lt;p&gt;It&amp;#39;s that the model lets me do things that I &lt;em&gt;might &lt;/em&gt;have done before but were expensive enough that I didn&amp;rsquo;t bother. I had three separate interactions this week that led to this blog post.&lt;/p&gt;&lt;p&gt;We had a production problem on an instance and no clear idea what was going on. What we did have was the log: something like 25-30 MB of compressed text describing everything that happened. And the actual problem wasn&amp;#39;t spotting an error: finding errors is easy. The problem was &lt;em&gt;correlation&lt;/em&gt;. We needed to line up different events across the timeline and understand how they were related.&lt;/p&gt;&lt;p&gt;In the past, I would have to trawl through the log and hope that something would pop up. These days, we can try handing the whole thing to the model and let it figure it out. If the log file wasn&amp;rsquo;t that big, it might even work. At dozens of MB, it doesn&amp;rsquo;t work (and it is quite expensive to try).&lt;/p&gt;&lt;p&gt;I went the other way. I told the model: &amp;ldquo;Write me a script that looks at the structure of this log (I gave it the first ten rows). I want the script to extract and aggregate the parts I care about, and render the result in a nice table to make it easier to understand.&amp;rdquo; &lt;/p&gt;&lt;p&gt;I had the view in under a minute, then I could explore the log and iterate: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;&amp;ldquo;Oh, I see that there are a lot of indexes. How many of them are for the same database?&amp;rdquo;&lt;/li&gt;&lt;li&gt;&amp;ldquo;Give me a histogram of index changes and their versions over time.&amp;rdquo;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The model wrote some code, produced a view, and I looked at it. Rinse &amp;amp; repeat until I had a pretty good idea what was going on. &lt;/p&gt;&lt;p&gt;The customer had &lt;em&gt;several&lt;/em&gt;&amp;nbsp;different versions of their application, each with its own set of indexes, and they kept overwriting one another, leading to a &lt;em&gt;huge&lt;/em&gt;&amp;nbsp;amount of indexing overhead. RavenDB actually has &lt;a href="https://docs.ravendb.net/7.0/client-api/operations/maintenance/indexes/set-index-lock#lock-modes"&gt;a dedicated feature for that scenario&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the part that &lt;em&gt;matters&lt;/em&gt;: I never read the code the model wrote. The moment the investigation was done, I threw all of it away. It&amp;#39;s throwaway code whose entire purpose was to help me &lt;em&gt;see&lt;/em&gt;, and once I had seen enough, I discarded it.&lt;/p&gt;&lt;p&gt;Without the model to write this code, I &lt;em&gt;could&lt;/em&gt;&amp;nbsp;have written it myself, but it is enough of a chore that it probably wouldn&amp;rsquo;t make sense. Doing that manually would have taken roughly the same amount of time. &lt;/p&gt;&lt;hr/&gt;&lt;p&gt;The second interaction is the opposite kind of work. I&amp;#39;m doing a fairly significant refactor of how a particular query executes in Corax, and that code is going into the product and staying there for a decade or two.&lt;/p&gt;&lt;p&gt;Here, the model writes and I drive. I tell it the overall direction, it goes somewhere, and then I decide if I like the result. I find it genuinely easier to react to something than to produce it from a blank page &amp;mdash; having a first draft to push against is faster than writing it all myself. Nevertheless, this is &lt;em&gt;my&lt;/em&gt;&amp;nbsp;code. I went over every single line, and I know exactly what&amp;#39;s in there.&lt;/p&gt;&lt;p&gt;That last part takes real discipline, and it&amp;#39;s worth being honest about why. When you&amp;#39;re in the zone chasing a change (try something out, revert, try something else, etc.), it is very easy to surface a few hours later staring at two thousand lines of changes you never actually wrote. You went through a dozen iterations, and somewhere in there the code stopped being something you &lt;em&gt;authored &lt;/em&gt;and became something that merely &lt;em&gt;happened&lt;/em&gt;. Guarding against that is really important, because otherwise that isn&amp;rsquo;t your code.&lt;/p&gt;&lt;p&gt;How do I make sure it&amp;#39;s still mine? I lean on tests, of course &amp;mdash; regression tests to prove I didn&amp;#39;t break the old behavior, and new tests built alongside the change to pin down the new behavior. That&amp;#39;s the baseline for anything long-lived. &lt;/p&gt;&lt;p&gt;The technique I found most useful for confirming that the change is really &lt;em&gt;mine&lt;/em&gt;&amp;nbsp;is a little unusual. I had it build a harness that runs a set of scenarios against both the old version and the new one. It&amp;#39;s a small app that issues queries and operations to the database and &lt;em&gt;visualizes&lt;/em&gt;&amp;nbsp;the results. &lt;/p&gt;&lt;p&gt;Here is what this looked like:&lt;/p&gt;&lt;p&gt;&lt;img src="/blog/Images/odjhw7en2-fkfarfy03scg.png"/&gt;&lt;/p&gt;&lt;p&gt;You can see that I have a bunch of scenarios that I&amp;rsquo;m testing, and it is very easy for me to track progress and &lt;em&gt;know&lt;/em&gt;&amp;nbsp;where I need to pay attention. The actual app had a lot more capabilities: what got faster, what got slower, the ranges, the memory used, everything and the kitchen sink went into that, in a format that made sense for the sort of work I was doing.&lt;/p&gt;&lt;p&gt;Each time I had a new direction, it was either driven by this application or I asked the model to &lt;em&gt;add&lt;/em&gt;&amp;nbsp;it to the application, so I could keep working on it. I kept working until nothing in the new version was slower than the old, and the headline paths were dramatically faster.&lt;/p&gt;&lt;p&gt;As an example of what this looked like most of the time, I ran a query, and then I inspected the structure we got back. Here is what some of that looked like:&lt;/p&gt;&lt;p&gt;&lt;img src="/blog/Images/zxv5mqmd9d1i5oyhp2t-zw.png"/&gt;&lt;/p&gt;&lt;p&gt;And as I went, I kept changing the harness itself &amp;mdash; show me this instead, group it that way. Trivial to do, because the harness is &lt;em&gt;also&lt;/em&gt;&amp;nbsp;throwaway. I&amp;#39;m not carrying it forward. I don&amp;#39;t care about its code quality. I never even looked at its code. It exists to make a point, and once it&amp;#39;s made the point, it&amp;#39;s gone.&lt;/p&gt;&lt;p&gt;I also used the model to add introspection hooks and visibility into what was going on inside the system, surfacing stuff that you would usually have to scratch your head and debug to understand. That meant that I was able to look at a problematic query, then just &lt;em&gt;look&lt;/em&gt;&amp;nbsp;at its query plan and the timing in it. I usually knew where I needed to pay attention from there.&lt;/p&gt;&lt;p&gt;To be honest, that part feels a lot like cheating.&lt;/p&gt;&lt;hr/&gt;&lt;p&gt;In the cases of the log analyzer and the comparison harness, the code is literally disposable. It&amp;rsquo;s scaffolding that would be thrown away after the work is done. I didn&amp;rsquo;t pay any attention to that code (I never read it), and it was never meant to be useful for anything else. &lt;/p&gt;&lt;p&gt;In the case of the production code, I went over each line of code so many times, I dreamt of it. A lot of the code there consists of annoying building blocks (building a visualization of the query plan as a graph, for example), which were sped up enormously by asking the model to build it for us. A lot of other code there is hand-crafted to say &lt;em&gt;exactly&lt;/em&gt;&amp;nbsp;what I needed it to.&lt;/p&gt;&lt;p&gt;But the fact that I can get &lt;em&gt;good &lt;/em&gt;scaffolding from the model for cheap changes a lot of the usual considerations. Because scaffolding is &lt;em&gt;literally&lt;/em&gt;&amp;nbsp;disposable code, I don&amp;rsquo;t have to worry about the usual code quality concerns. The log analyzer would probably take two or three hours to write (without the pretty graphics, which were &lt;em&gt;helpful&lt;/em&gt;&amp;nbsp;for easily identifying what was going on). &lt;/p&gt;&lt;p&gt;The comparison harness would be multiple weeks of effort and would probably be a non-interactive ASCII table. In fact, I don&amp;rsquo;t need to guess. Scaffolding isn&amp;rsquo;t something that is new, I do that all the time. Here is an example of one, written about a decade ago:&lt;/p&gt;&lt;p&gt;&lt;img src="/blog/Images/m8lvgikuqemdfrvp-dtczw.png"/&gt;&lt;/p&gt;&lt;p&gt;In the image above, you can find the internal structure of a B+Tree inside RavenDB. Contrast that with the following scaffolding for query plans. That one, by the way, is actually staying in the product. &lt;/p&gt;&lt;p&gt;Compare that to the level of insight that you can derive from the query plan higher up in this post. The B+Tree scaffolding, by the way, is &lt;em&gt;essential &lt;/em&gt;to understanding the more complex scenarios. It paid for the time it took to write it many times over.&lt;/p&gt;&lt;p&gt;The ability to now effectively do the same at very little cost means that the act of building software itself is now easier. Not because someone else is writing the core code, but because &lt;em&gt;everything else&lt;/em&gt;&amp;nbsp;that we need to do is also easier.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/204067-a/the-best-code-is-the-one-you-shift-delete?Key=8b5a5104-ec4c-48b9-9a86-4d2a1715e0d0</link><guid>http://ayende.com/204067-a/the-best-code-is-the-one-you-shift-delete?Key=8b5a5104-ec4c-48b9-9a86-4d2a1715e0d0</guid><pubDate>Fri, 03 Jul 2026 12:00:00 GMT</pubDate></item><item><title>"Optimizing" concurrent regexes</title><description>&lt;p&gt;I am looking into some regex work, and I ran into a performance problem. I need to run a particular regex over a large number (millions) of strings. That caused my spidey sense to&amp;hellip; tingle. &lt;/p&gt;&lt;p&gt;The code in question looked something like this:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-csharp'&gt;&lt;code class='line-numbers language-csharp'&gt;&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;long&lt;/span&gt;&lt;/span&gt; matches &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token function"&gt;CountMatchingEntries&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token constructor-invocation class-name"&gt;Regex&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;@"\s+user id\s+"&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;Creating a regex for each invocation is&amp;hellip; expensive. That is why we have the &lt;code&gt;RegexOptions.Compiled&lt;/code&gt;flag, after all. And the &lt;code&gt;Regex&lt;/code&gt;&amp;nbsp;class is thread-safe, so I did the equivalent of this code:&lt;/p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-csharp'&gt;&lt;code class='line-numbers language-csharp'&gt;&lt;span class="token comment"&gt;// class level&lt;/span&gt;
&lt;span class="token keyword"&gt;static&lt;/span&gt; &lt;span class="token class-name"&gt;Regex&lt;/span&gt; s_regex &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token constructor-invocation class-name"&gt;Regex&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;@"\s+user id\s+"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; RegexOptions&lt;span class="token punctuation"&gt;.&lt;/span&gt;Compiled&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token comment"&gt;// inside a method&lt;/span&gt;
&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;long&lt;/span&gt;&lt;/span&gt; matches &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token function"&gt;CountMatchingEntries&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;s_regex&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;p&gt;The performance of the system immediately took a &lt;em&gt;big,&lt;/em&gt;&amp;nbsp;stinking performance regression all over my benchmarks. At first, I was sure that I wasn&amp;rsquo;t doing something properly, so I re-wrote this using the modern approach, with source generators, like this:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-csharp'&gt;&lt;code class='line-numbers language-csharp'&gt;&lt;span class="token keyword"&gt;public&lt;/span&gt; &lt;span class="token keyword"&gt;partial&lt;/span&gt; &lt;span class="token keyword"&gt;class&lt;/span&gt; &lt;span class="token class-name"&gt;MyClass&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;[&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token attribute&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;token class-name&amp;quot;&amp;gt;GeneratedRegex&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token attribute-arguments&amp;quot;&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token string&amp;quot;&amp;gt;@&amp;quot;\s+user id\s+&amp;quot;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;,&amp;lt;/span&amp;gt; 
    RegexOptions&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;Compiled &amp;lt;span class=&amp;quot;token operator&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt; RegexOptions&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;CultureInvariant &amp;lt;span class=&amp;quot;token operator&amp;quot;&amp;gt;|&amp;lt;/span&amp;gt;
    RegexOptions&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;IgnoreCase&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;]&amp;lt;/span&amp;gt;
 &amp;lt;span class=&amp;quot;token keyword&amp;quot;&amp;gt;public&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;token keyword&amp;quot;&amp;gt;static&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;token keyword&amp;quot;&amp;gt;partial&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;token return-type class-name&amp;quot;&amp;gt;Regex&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;token function&amp;quot;&amp;gt;UserIdRegex&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;(&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;)&amp;lt;/span&amp;gt;&amp;lt;span class=&amp;quot;token punctuation&amp;quot;&amp;gt;;&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;That had the exact same behavior, a major performance &lt;em&gt;regression&lt;/em&gt;. &lt;/p&gt;&lt;p&gt;We are talking about this making the code &lt;em&gt;six times slower&lt;/em&gt;. That is a &lt;em&gt;huge &lt;/em&gt;cost for something that every fiber in my being tells me &lt;em&gt;should&lt;/em&gt; be faster. As I started digging into things, I managed to reproduce this in an isolated manner. &lt;/p&gt;&lt;p&gt;The following benchmark shows the core of the problem:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-csharp'&gt;&lt;code class='line-numbers language-csharp'&gt;&lt;span class="token keyword"&gt;using&lt;/span&gt; &lt;span class="token namespace"&gt;System&lt;span class="token punctuation"&gt;.&lt;/span&gt;Diagnostics&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token keyword"&gt;using&lt;/span&gt; &lt;span class="token namespace"&gt;System&lt;span class="token punctuation"&gt;.&lt;/span&gt;Text&lt;span class="token punctuation"&gt;.&lt;/span&gt;RegularExpressions&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; lines &lt;span class="token operator"&gt;=&lt;/span&gt; Enumerable&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Range&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token number"&gt;100_000&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Select&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;i &lt;span class="token operator"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="token interpolation-string"&gt;&lt;span class="token string"&gt;$&amp;quot;The user id #&lt;/span&gt;&lt;span class="token interpolation"&gt;&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;span class="token expression language-csharp"&gt;i&lt;/span&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="token string"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;ToArray&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; regex &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token constructor-invocation class-name"&gt;Regex&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;@&amp;quot;\s+user id\s+&amp;quot;&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; RegexOptions&lt;span class="token punctuation"&gt;.&lt;/span&gt;Compiled &lt;span class="token operator"&gt;|&lt;/span&gt; RegexOptions&lt;span class="token punctuation"&gt;.&lt;/span&gt;CultureInvariant &lt;span class="token operator"&gt;|&lt;/span&gt; RegexOptions&lt;span class="token punctuation"&gt;.&lt;/span&gt;IgnoreCase&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token comment"&gt;// This is fast&lt;/span&gt;&lt;br /&gt;
&lt;span class="token function"&gt;Exec&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token operator"&gt;=&amp;gt;&lt;/span&gt; lines&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Count&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;l &lt;span class="token operator"&gt;=&amp;gt;&lt;/span&gt; regex&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;IsMatch&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;l&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token comment"&gt;// This is slow&lt;/span&gt;&lt;br /&gt;
&lt;span class="token function"&gt;Exec&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token operator"&gt;=&amp;gt;&lt;/span&gt; lines&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;AsParallel&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Count&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;l &lt;span class="token operator"&gt;=&amp;gt;&lt;/span&gt; regex&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;IsMatch&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;l&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class="token keyword"&gt;static&lt;/span&gt; &lt;span class="token return-type class-name"&gt;&lt;span class="token keyword"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span class="token function"&gt;Exec&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token class-name"&gt;Func&lt;span class="token punctuation"&gt;&amp;lt;&lt;/span&gt;&lt;span class="token keyword"&gt;int&lt;/span&gt;&lt;span class="token punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; run&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; before &lt;span class="token operator"&gt;=&lt;/span&gt; GC&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;GetTotalAllocatedBytes&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; sw &lt;span class="token operator"&gt;=&lt;/span&gt; Stopwatch&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;StartNew&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token comment"&gt;//var count = lines.AsParallel().Count(l =&amp;gt; MyClass.UserIdRegex().IsMatch(l));&lt;/span&gt;&lt;br /&gt;
&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; count &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token function"&gt;run&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
sw&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Stop&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token class-name"&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt;&lt;/span&gt; after &lt;span class="token operator"&gt;=&lt;/span&gt; GC&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;GetTotalAllocatedBytes&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
Console&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;WriteLine&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token interpolation-string"&gt;&lt;span class="token string"&gt;$&amp;quot;Count: &lt;/span&gt;&lt;span class="token interpolation"&gt;&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;span class="token expression language-csharp"&gt;count&lt;/span&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="token string"&gt;, Time: &lt;/span&gt;&lt;span class="token interpolation"&gt;&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;span class="token expression language-csharp"&gt;sw&lt;span class="token punctuation"&gt;.&lt;/span&gt;ElapsedMilliseconds&lt;/span&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="token string"&gt; ms, Memory: &lt;/span&gt;&lt;span class="token interpolation"&gt;&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;span class="token expression language-csharp"&gt;after &lt;span class="token operator"&gt;-&lt;/span&gt; before&lt;/span&gt;&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="token string"&gt; bytes&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;I create the &lt;em&gt;same&lt;/em&gt;&lt;code&gt;Regex &lt;/code&gt;instance and run it 100,000 times. The first time, I do that using a single thread, and the second time I’m using multiple threads.&lt;/p&gt;&lt;p&gt;The only difference between those runs is the addition of &lt;code&gt;AsParallel() &lt;/code&gt;to force it to use multiple threads. My code isn’t actually using this or explicit threads, but it &lt;em&gt;is &lt;/em&gt;using a single cached &lt;code&gt;Regex&lt;/code&gt; instance in a web environment, so under load, it is being used concurrently.&lt;/p&gt;&lt;p&gt;What is going on here? The parallel code is &lt;em&gt;much&lt;/em&gt; slower because it allocates. It turns out that deep in the guts of .NET’s Regex engine we have &lt;a href="https://github.com/dotnet/runtime/blob/9ce1cb968e7d392e0c03059537236b1aa6e63ab0/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs#L576"&gt;this block of code&lt;/a&gt;:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-csharp'&gt;&lt;code class='line-numbers language-csharp'&gt;&lt;span class="token class-name"&gt;RegexRunner&lt;/span&gt; runner &lt;span class="token operator"&gt;=&lt;/span&gt; Interlocked&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Exchange&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token keyword"&gt;ref&lt;/span&gt; _runner&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token keyword"&gt;null&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token operator"&gt;??&lt;/span&gt; &lt;span class="token function"&gt;CreateRunner&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token keyword"&gt;try&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;br /&gt;
&lt;span class="token comment"&gt;// do work&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class="token keyword"&gt;finally&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;&lt;br /&gt;
_runner &lt;span class="token operator"&gt;=&lt;/span&gt; runner&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;br /&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;In other words, the actual &lt;code&gt;RegexRunner&lt;/code&gt; needs to keep some mutable state, which doesn’t play nicely with threads. In order to maintain itself under concurrent usage, the &lt;code&gt;Regex&lt;/code&gt; “checks out” the instance when it is being used, so it can be the sole owner.&lt;/p&gt;&lt;p&gt;Other callers on the same instance at the same time will &lt;em&gt;allocate a new runner instance&lt;/em&gt;. That is what is causing the massive slowdown. If we are using the Regex instance in a single-threaded manner, the code will check it in &amp;amp; out as needed, with zero allocations and quite fast.&lt;/p&gt;&lt;p&gt;If you are using that from concurrent code, you’ll allocate like crazy and can expect your performance to drop by as much as five times.&lt;/p&gt;&lt;p&gt;I created &lt;a href="https://github.com/dotnet/runtime/issues/129445"&gt;an issue for that&lt;/a&gt;, since I believe this is quite a tripping hazard in terms of performance. &lt;/p&gt;&lt;p&gt;The current fix that I found was to use &lt;code&gt;ThreadLocal&amp;lt;Regex&amp;gt;&lt;/code&gt; for this, ensuring that there is no actual concurrent usage, at the cost of higher memory usage and repeated initializations. &lt;/p&gt;&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;
</description><link>http://ayende.com/204035-a/optimizing-concurrent-regexes?Key=eaa35d86-bdd7-4d1e-8ac3-bd4a06a9a914</link><guid>http://ayende.com/204035-a/optimizing-concurrent-regexes?Key=eaa35d86-bdd7-4d1e-8ac3-bd4a06a9a914</guid><pubDate>Fri, 19 Jun 2026 12:00:00 GMT</pubDate></item><item><title>Non obvious optimization with divide and conquer</title><description>&lt;p&gt;Deep in the heart of Corax (RavenDB&amp;rsquo;s querying engine), everything deals with something called a Posting List. Posting Lists are a way for the engine to say &amp;ldquo;all of those documents have the term &lt;code&gt;Fast&lt;/code&gt;&amp;nbsp;for the field &lt;code&gt;Speed&lt;/code&gt;&amp;rdquo;. &amp;nbsp;Conceptually, a Posting List is an ordered set of document ids. In this case (and this is important, the ids in question are numeric, not RavenDB&amp;rsquo;s document id, which is a string).&lt;/p&gt;&lt;p&gt;An interesting problem with Posting Lists is that a term can be unique (such as a GUID) - only a single document will ever have this value. They can have a small set of values (for example, CreationDate, where only the items created on that day will share the same value). Or they can have many values (for example, &lt;code&gt;Status = &amp;lsquo;Shipped&amp;rsquo;&lt;/code&gt;&amp;nbsp;for Orders).&lt;/p&gt;&lt;p&gt;The reason those details matter is that we can deal with the three (very) different modes in a distinct manner to reduce the cost of storage that Corax uses for Posting Lists. Internally, Corax has the notion of a &lt;code&gt;PostingListId,&lt;/code&gt;&amp;nbsp;which is just a 64-bit number. We use the least significant 2 bits to tell us what kind of Posting List this is. &lt;/p&gt;&lt;p&gt;Typical code to consume this looks like this:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-dart'&gt;&lt;code class='line-numbers language-dart'&gt;&lt;span class="token keyword"&gt;while&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;read &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;provider&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;FillPostingListIds&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;plIds&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
    &lt;span class="token keyword"&gt;for&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;int i &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt; i &lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt; read&lt;span class="token punctuation"&gt;;&lt;/span&gt; i&lt;span class="token operator"&gt;++&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
    &lt;span class="token punctuation"&gt;{&lt;/span&gt;
        &lt;span class="token keyword"&gt;var&lt;/span&gt; postingListId &lt;span class="token operator"&gt;=&lt;/span&gt; plIds&lt;span class="token punctuation"&gt;[&lt;/span&gt;i&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        &lt;span class="token keyword"&gt;var&lt;/span&gt; termType &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token class-name"&gt;TermIdMask&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;postingListId &lt;span class="token operator"&gt;&amp;amp;&lt;/span&gt; &lt;span class="token class-name"&gt;TermIdMask.EnsureIsSingleMask&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;


        &lt;span class="token keyword"&gt;switch&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;termType&lt;span class="token punctuation"&gt;)&lt;/span&gt;
        &lt;span class="token punctuation"&gt;{&lt;/span&gt;
            &lt;span class="token keyword"&gt;case&lt;/span&gt; &lt;span class="token class-name"&gt;TermIdMask.Single&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;
            &lt;span class="token punctuation"&gt;{&lt;/span&gt;
                &lt;span class="token comment"&gt;// Accumulate the single decoded entry ID into the entryBuffer&lt;/span&gt;
                &lt;span class="token comment"&gt;// Flush to bitmap if the buffer is full&lt;/span&gt;
                &lt;span class="token keyword"&gt;break&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation"&gt;}&lt;/span&gt;


            &lt;span class="token keyword"&gt;case&lt;/span&gt; &lt;span class="token class-name"&gt;TermIdMask.SmallPostingList&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;
            &lt;span class="token punctuation"&gt;{&lt;/span&gt;
                &lt;span class="token comment"&gt;// Decode inline via FastPForBufferedReader into the entryBuffer&lt;/span&gt;
                &lt;span class="token comment"&gt;// Flush to bitmap if the buffer is full&lt;/span&gt;
                &lt;span class="token keyword"&gt;break&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation"&gt;}&lt;/span&gt;


            &lt;span class="token keyword"&gt;case&lt;/span&gt; &lt;span class="token class-name"&gt;TermIdMask.PostingList&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;
            &lt;span class="token punctuation"&gt;{&lt;/span&gt;
                &lt;span class="token comment"&gt;// Flush any accumulated entries from the buffer first&lt;/span&gt;
                &lt;span class="token comment"&gt;// Iterate through the full large posting list via FillFromPostings&lt;/span&gt;
                &lt;span class="token keyword"&gt;break&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
            &lt;span class="token punctuation"&gt;}&lt;/span&gt;


            &lt;span class="token keyword"&gt;default&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;
                &lt;span class="token keyword"&gt;throw&lt;/span&gt; &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;InvalidOperationException&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;$&lt;span class="token string-literal"&gt;&lt;span class="token string"&gt;"Unknown TermIdMask type: {termType}"&lt;/span&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        &lt;span class="token punctuation"&gt;}&lt;/span&gt;
    &lt;span class="token punctuation"&gt;}&lt;/span&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;The code here iterates through a list of Posting List ids, handling each one of the options. This is part of handling queries such as: &lt;code&gt;where CreatedAt &amp;gt; $lastQuarter&lt;/code&gt;. We have to get all the distinct dates in the range, and for each date, we need to get all the matching documents for it.&lt;/p&gt;&lt;p&gt;The code here is pretty simple, right? It is fairly obvious what it does, but it has a pretty big problem. It processes each one of the Posting Lists manually &amp;amp; separately. There are two problems with this approach:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;We end up doing a lot of branching, based on which Posting List type we are processing.&lt;/li&gt;&lt;li&gt;We lose the ability to handle the Posting Lists in bulk.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Because we use the lowest two bits to store the type of the Posting List, we can do better. The insight behind the new approach is that (id &amp;amp; EnsureIsSingleMask)&amp;nbsp;naturally yields 0, 1, or 2 &amp;mdash; a perfect index into an array of buckets. Instead of a switch statement, we partition the batch in one pass with no per-item branches:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-bash'&gt;&lt;code class='line-numbers language-bash'&gt;var buckets &lt;span class="token operator"&gt;=&lt;/span&gt; new List&lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt;long&lt;span class="token operator"&gt;&gt;&lt;/span&gt;&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token number"&gt;3&lt;/span&gt;&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token keyword"&gt;while&lt;/span&gt; &lt;span class="token variable"&gt;&lt;span class="token punctuation"&gt;((&lt;/span&gt;read &lt;span class="token operator"&gt;=&lt;/span&gt; provider.FillPostingListIds&lt;span class="token punctuation"&gt;(&lt;/span&gt;plIds&lt;span class="token punctuation"&gt;))&lt;/span&gt;&lt;/span&gt; &lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
   &lt;span class="token keyword"&gt;for&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;int i &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt; i &lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt; &lt;span class="token builtin class-name"&gt;read&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt; i++&lt;span class="token punctuation"&gt;)&lt;/span&gt;
   &lt;span class="token punctuation"&gt;{&lt;/span&gt;
       buckets&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;int&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;plIds&lt;span class="token punctuation"&gt;[&lt;/span&gt;i&lt;span class="token punctuation"&gt;]&lt;/span&gt; &lt;span class="token operator"&gt;&amp;amp;&lt;/span&gt; 0b11&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;]&lt;/span&gt;.AddUnsafe&lt;span class="token punctuation"&gt;(&lt;/span&gt;pid&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
   &lt;span class="token punctuation"&gt;}&lt;/span&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;Of course, you&amp;rsquo;ll note that we aren&amp;rsquo;t actually &lt;em&gt;processing&lt;/em&gt;&amp;nbsp;those, just putting them in buckets. The fact that we are able to split them into groups in a branchless manner is a fun optimization task, but it doesn&amp;rsquo;t matter as much as the &lt;em&gt;next&lt;/em&gt;&amp;nbsp;stage&amp;hellip; we can now deal with a &lt;em&gt;list&lt;/em&gt;&amp;nbsp;of Posting Lists that are already divided by type.&lt;/p&gt;&lt;p&gt;For example, for the list holding only a single unique value, I can run the following:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-dart'&gt;&lt;code class='line-numbers language-dart'&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt; singlesSpan &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;CollectionMarshal.AsSpan&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;buckets&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token class-name"&gt;EntryIdEncodings.DecodeAndDiscardFrequency&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;singlesSpan&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;singlesSpan&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;Length&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token keyword"&gt;var&lt;/span&gt; singlesLen &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;Sorting.SortAndRemoveDuplicates&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;singlesSpan&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;bitmap&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;AddRange&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;singlesSpan&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;singlesLen&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;This is great, because now I can process the entire list using SIMD in a highly efficient manner. But things get better when we look at the &lt;em&gt;other&lt;/em&gt;&amp;nbsp;lists. In the case of the small Posting Lists, for example, the ids that I&amp;rsquo;m reading are not the actual values, but point to where the values actually reside. &lt;/p&gt;&lt;p&gt;This gives me the chance to actually load them from disk in an optimal, batched manner, like so:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-dart'&gt;&lt;code class='line-numbers language-dart'&gt;&lt;span class="token keyword"&gt;var&lt;/span&gt; smallsSpan &lt;span class="token operator"&gt;=&lt;/span&gt; buckets&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token number"&gt;1&lt;/span&gt;&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;ToSpan&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token class-name"&gt;EntryIdEncodings.DecodeAndDiscardFrequency&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;smallsSpan&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;smallsSpan&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;Length&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token keyword"&gt;var&lt;/span&gt; smallLen &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;Sorting.SortAndRemoveDuplicates&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;smallsSpan&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token class-name"&gt;Container.GetAll&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;llt&lt;span class="token punctuation"&gt;,&lt;/span&gt; smallsSpan&lt;span class="token punctuation"&gt;[&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token punctuation"&gt;.&lt;/span&gt;smallLen&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;containerItems&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;ToSpan&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;long&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;MinValue&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; pageLocator&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;


&lt;span class="token keyword"&gt;for&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;int i &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt; i &lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt; smallLen&lt;span class="token punctuation"&gt;;&lt;/span&gt; i&lt;span class="token operator"&gt;++&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
   &lt;span class="token keyword"&gt;var&lt;/span&gt; item &lt;span class="token operator"&gt;=&lt;/span&gt; containerItems&lt;span class="token punctuation"&gt;[&lt;/span&gt;i&lt;span class="token punctuation"&gt;]&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
   &lt;span class="token comment"&gt;// read the small posting list and deal with it&lt;/span&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;The key here is the &lt;code&gt;Container.GetAll()&lt;/code&gt;&amp;nbsp;call, which takes the list of unique Postings List locations and loads them in an optimized manner. In the previous code style, that was actually pretty hard to do. In this manner, it falls naturally from the way we write the code.&lt;/p&gt;&lt;p&gt;There are also advantages to the fact that we run tight loops with the same code, instead of branching for each type. We also ended up with less code overall, which is also nice.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/204003-a/non-obvious-optimization-with-divide-and-conquer?Key=1fc2405c-08de-4e3e-90ec-79bbb4bab33a</link><guid>http://ayende.com/204003-a/non-obvious-optimization-with-divide-and-conquer?Key=1fc2405c-08de-4e3e-90ec-79bbb4bab33a</guid><pubDate>Tue, 16 Jun 2026 12:00:00 GMT</pubDate></item><item><title>Learning to code, 1990s vs 2026</title><description>&lt;p&gt;I still remember the bookstore. I was holding a 600-page brick of a book on how to build Windows applications, trying to convince my mother that I &lt;em&gt;really&lt;/em&gt;&amp;nbsp;needed it. This was 1994 or 1995. A book was how you learned to program at that time. You took it home, you read it cover to cover, you typed the examples by hand, and somewhere along the way, the ideas sank in.&lt;/p&gt;
&lt;p&gt;From there, the tools for learning kept evolving. Printed books gave way to CD-ROMs and then to online documentation. Then came the explosion of blogs and RSS feeds. I started this blog at that time, and I still consider that era to be one of the best ones in terms of having amazing access to &lt;em&gt;smart&lt;/em&gt;&amp;nbsp;and knowledgeable people, freely sharing their insights and experiences.&lt;/p&gt;
&lt;p&gt;Google killed Google Reader (yes, I am still angry about that)&amp;nbsp;and a lot of the&amp;nbsp;new people learned via Stack Overflow. The world entered a strange equilibrium that lasted, honestly, more than a decade. If you learned to code any time between roughly 2010 and 2022, you probably learned through some combination of Google, Stack Overflow, and maybe YouTube.&lt;/p&gt;
&lt;p&gt;Then the floor moved again. First it was ChatGPT, where you copy-pasted code back and forth. Then the models were integrated into the IDE. Now, with Claude Code and Codex, it is something else entirely: an agent that just runs, makes decisions, and does the thing.&lt;/p&gt;
&lt;p&gt;The arc is striking when you lay it out. You used to have to go to a physical library, pick up a physical book, read it, digest it, and think about it. Today, the prevailing message to a new developer is essentially: you do not need to know any of that. Just describe what you want, and it happens.&lt;/p&gt;
&lt;h3&gt;Hidden costs for reduced conceptual depth&lt;/h3&gt;
&lt;p&gt;This shift is not just about convenience. It changes the &lt;em&gt;depth&lt;/em&gt;&amp;nbsp;of knowledge a developer carries, and that has consequences. Here is the example I keep coming back to. Imagine you ask a developer to show you a website that they built.&lt;/p&gt;
&lt;p&gt;If you asked that in the late nineties, it meant &lt;em&gt;something&lt;/em&gt;. To do that, you had to purchase a domain. Understand DNS well enough to wire it up correctly. Set up a web server, which meant getting Apache to actually run. Successfully configure PHP and deploy scripts to production.&lt;/p&gt;
&lt;p&gt;By the time you could point to a working URL, you &lt;em&gt;had&lt;/em&gt;&amp;nbsp;to touch every layer of the stack. There was no other choice. Therefore, you were at least passingly familiar with a lot more than you would be today.&lt;/p&gt;
&lt;p&gt;Ask that same question of many developers today, and the answer is a Vercel subdomain. That is not a dig at Vercel, mind you - it is a great product, and abstraction is the whole point. But some of these developers genuinely do not &lt;em&gt;know&lt;/em&gt;&amp;nbsp;what DNS is. They do not know what is running on the server versus the client. They do not know that there is even a meaningful distinction. And we have seen real security incidents come out of exactly that gap &amp;mdash; secrets leaking into client bundles, auth logic running where it should not, and CORS misconfigurations that nobody understood well enough to notice.&lt;/p&gt;
&lt;p&gt;Now extend that same dynamic one more step. Take the cohort of developers who will learn to program primarily through this new generation of agentic tools. The abstraction is no longer just over DNS or deployment. It is over the act of writing the code itself.&lt;/p&gt;
&lt;h3&gt;What is the role of a junior developer now?&lt;/h3&gt;
&lt;p&gt;I think we are going to end up with a genuinely different type of engineer and, as a result, a genuinely different type of system.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;If men learn this, it will implant forgetfulness in their souls; they will cease to exercise memory because they rely on that which is written, calling things to remembrance no longer from within themselves, but by means of external marks&amp;rdquo;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;Plato, Phaedrus (c. 429-347 BCE) &amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Every generation has been accused of being softer than the previous generation, as the quote above can testify. In this case, Plato is decrying &lt;em&gt;writing&lt;/em&gt;&amp;nbsp;as a corrupting influence on youth who no longer bother to just &lt;em&gt;remember&lt;/em&gt;&amp;nbsp;things.&lt;/p&gt;
&lt;p&gt;Without the attribution, I don&amp;rsquo;t think you would have realized that this isn&amp;rsquo;t me talking about developers utilizing coding agents instead of learning on their own.&lt;/p&gt;
&lt;p&gt;In software, we see much the same pattern. The person who wrote assembly looked down on the C programmer. The C programmer looked down on the Java programmer. The Java programmer looked down on the person gluing libraries together in Python. Each step up the abstraction ladder lets people build bigger, more ambitious things with less effort. That is mostly good.&lt;/p&gt;
&lt;p&gt;But there is a real asymmetry this time. The earlier steps abstracted away mechanical work &amp;mdash; memory management, boilerplate, deployment plumbing. This step abstracts away the reasoning itself. And reasoning is what you need when the abstraction leaks, which it always eventually does.&lt;/p&gt;
&lt;p&gt;The question I am actually struggling with, day to day, is much more practical: how do I evaluate a junior developer in this sort of world?&lt;/p&gt;
&lt;p&gt;The classic move was a take-home task. Build a small feature. Show me your thinking. The problem is that a capable model will produce a perfectly clean solution to any reasonable take-home in a few minutes. What you see in the submission tells you almost nothing about what the candidate actually understands. It tells you they can prompt well, which is a real skill, but it is not the skill I am trying to measure.&lt;/p&gt;
&lt;p&gt;I can also ask them to solve a task while they are in our offices, so I can verify no AI use. But that is also stupid; I &lt;em&gt;want &lt;/em&gt;them to use AI. After all, that is a great productivity enhancer. So I need a way to test understanding, not just the output.&lt;/p&gt;
&lt;p&gt;The signals I care about are the ones that are hardest to fake in an agent-assisted world. Can you debug something when the model is wrong? Can you explain why a piece of generated code is subtly unsafe, or slow, or wrong in a way that only matters at the hundredth user? Can you make a reasoned call about which abstraction to reach for and which one to reject? When the system behaves unexpectedly, do you know where to look?&lt;/p&gt;
&lt;p&gt;At the same time, those aren&amp;rsquo;t usually qualities that you &lt;em&gt;can&lt;/em&gt;&amp;nbsp;look for in a junior developer. Having those qualities usually means that they aren&amp;rsquo;t junior anymore.&lt;/p&gt;
&lt;p&gt;People used to train on LeetCode tests as a way to show how good they were in interviews. That was a good stand-in to see what they knew and understood. What is the next stage here?&lt;/p&gt;
&lt;p&gt;What does a junior do to exercise their skills and show that they can bring value to the team? I don&amp;rsquo;t know if I have good answers to those questions. But that is something we, as an industry, need to consider carefully.&lt;/p&gt;
&lt;p&gt;I do not want to be the old man yelling at the cloud. The tools are genuinely great, and refusing to use them is its own kind of malpractice. AI coding agents can make you &lt;em&gt;meaningfully &lt;/em&gt;more productive.&lt;/p&gt;
&lt;p&gt;But when I talk to developers just starting out, the thing I keep pushing is this: use the tools, and also, on a regular basis, go down a layer. Set up a server yourself. Deploy something without a platform holding your hand. Read the DNS records. Look at what your framework is actually generating. Write something in a language without a package manager that hides the sharp edges.&lt;/p&gt;
&lt;p&gt;Not because you will do it that way at work. But because the next time something breaks in a way the agent cannot fix&amp;nbsp;you will have a mental model to fall back on. You will know where the seams are. You will know what to look at.&lt;/p&gt;
&lt;p&gt;That mental model is, I suspect, going to be the thing that separates the engineers who compound over a career from the ones who get stuck the first time the abstraction leaks.&lt;/p&gt;
</description><link>http://ayende.com/203975-a/learning-to-code-1990s-vs-2026?Key=4bf78bb8-056a-412e-adcc-758ff6f269f1</link><guid>http://ayende.com/203975-a/learning-to-code-1990s-vs-2026?Key=4bf78bb8-056a-412e-adcc-758ff6f269f1</guid><pubDate>Tue, 05 May 2026 12:00:00 GMT</pubDate></item><item><title>The GPU Is the New Bangalore </title><description>&lt;p&gt;In the 2000s, the hottest move in software was offshoring. You&amp;#39;d ship your requirements to a development shop in India, Vietnam, or Bangladesh, pay a fraction of Western developer rates, and wait. The cost savings were real, every spreadsheet said so. The failure modes were also real, every CTO said so.&lt;/p&gt;&lt;p&gt;Even assuming that the teams working on your code were smart, motivated, and hardworking, the distance, communication overhead, the time zone mismatch, and misaligned incentives created a brutal set of constraints. If you wanted to get good results from offshoring, &amp;nbsp;you needed to be able to clearly specify what you wanted and be &lt;em&gt;good&lt;/em&gt;&amp;nbsp;at validating that you got what you expected.&lt;/p&gt;&lt;p&gt;You couldn&amp;#39;t just say &amp;quot;I need a login system.&amp;quot; You had to write detailed specs, break work into reviewable chunks, define acceptance criteria, and actually &lt;em&gt;read&lt;/em&gt;&amp;nbsp;the code that came back. Not rubber-stamp it. Read it, make sure that it passed muster and could be accepted internally, because the delta between &amp;quot;looks right&amp;quot; and &amp;quot;is right&amp;quot; could cost you six months of production incidents.&lt;/p&gt;&lt;p&gt;Sound familiar? Today, instead of shipping my requirements to a dev shop overseas, I&amp;#39;m shipping them to a GPU somewhere. I get something back. It looks like code. It might &lt;em&gt;be&lt;/em&gt;&amp;nbsp;code. It might be a very convincing facsimile of code that will quietly fail in production under load. I genuinely don&amp;#39;t know until I sit down and read it carefully.&lt;/p&gt;&lt;p&gt;The same discipline that separated successful offshore engagements from expensive disasters applies here as well:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Specification quality determines output quality.&lt;/strong&gt;&amp;nbsp;Vague prompts return vague code. The ability to articulate exactly what you want &amp;mdash; at the right level of abstraction &amp;mdash; is now a core engineering skill.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Validation is non-negotiable.&lt;/strong&gt;&amp;nbsp;&amp;quot;It passed the vibe check&amp;quot; is not a code review. The reviewer needs to understand what the code is doing and why, not just that it compiles and the tests are green.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Iterative delivery beats big-bang delivery.&lt;/strong&gt;&amp;nbsp;Nobody who survived offshoring tried to outsource an entire product in one shot. You stage it. You review at each stage. You course-correct before mistakes compound.&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;The Bottleneck Has Moved&lt;/h3&gt;&lt;p&gt;Here&amp;#39;s what I think is the deeper shift: for most of software history, the bottleneck was &lt;em&gt;writing the code&lt;/em&gt;. That took time and required expensive humans. So the industry optimized heavily around it, better editors, better frameworks, and better abstractions. All in service of making the act of writing code faster and less error-prone.&lt;/p&gt;&lt;p&gt;That bottleneck is collapsing. What once took six months might take six hours. When the cost of implementation approaches zero, the bottleneck moves upstream: to design, specification, and verification. The expensive parts are now:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Understanding the problem clearly enough to describe it precisely.&lt;/li&gt;&lt;li&gt;Decomposing it into well-scoped, independently verifiable pieces.&lt;/li&gt;&lt;li&gt;Reviewing what comes back and actually understanding it.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;These are skills we largely deprioritized during the era when coding itself was the hard part. They&amp;#39;re about to become the most valuable things a technical person can do.&lt;/p&gt;&lt;p&gt;A lot of that used to be done &amp;ldquo;along the way&amp;rdquo; when you wrote the code. You would explore the problem and gain depth of understanding as you wrote the code. Now that just doesn&amp;rsquo;t happen, but you still need to do that work explicitly.&lt;/p&gt;&lt;h3&gt;A note about the importance of proper architecture&lt;/h3&gt;&lt;p&gt;There is this idea that the path to building big systems with AI is to spin up a swarm of specialized agents (a frontend agent, a backend agent, a database administrator agent, etc.) and somehow orchestrate them into a coherent product.&lt;/p&gt;&lt;p&gt;I find this baffling, because we already have a well-established protocol for coordinating the work of specialized, partially independent contributors on a complex system. It&amp;#39;s called software design.&lt;/p&gt;&lt;p&gt;Module boundaries. Interface contracts. Separation of concerns. Dependency management. SOLID principles and more. These patterns exist precisely because complex systems built by multiple contributors without clear interfaces turn into unmaintainable messes. This is true whether those contributors are humans, offshore teams, or language models.&lt;/p&gt;&lt;p&gt;The instinct to throw orchestration complexity at a coordination problem is exactly backwards. The answer isn&amp;#39;t a smarter message bus between your agents. The answer is better system design that minimizes how much the pieces need to talk to each other in the first place.&lt;/p&gt;&lt;p&gt;We have literally decades of experience in how to build large software systems (and thousands of years of experience in how to handle large projects in general). There isn&amp;rsquo;t anything inherently new here to deal with.&lt;/p&gt;&lt;p&gt;The developers who will thrive in this environment aren&amp;#39;t necessarily the ones who write the most elegant code. They&amp;#39;re the ones who can hold a complex system design in their head and communicate it clearly, break the work into well-specified, verifiable increments, and actually read the code that comes back and hold it to a real standard of quality.&lt;/p&gt;&lt;p&gt;These are, in large part, the same skills that made the best engineering leads effective during the offshoring era. The context has changed completely. The discipline hasn&amp;#39;t.&lt;/p&gt;&lt;p&gt;The GPU is the new Bangalore. Time to dust off the playbook.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203974-a/the-gpu-is-the-new-bangalore?Key=ffd714bb-2bf5-4256-8143-753e268a108d</link><guid>http://ayende.com/203974-a/the-gpu-is-the-new-bangalore?Key=ffd714bb-2bf5-4256-8143-753e268a108d</guid><pubDate>Fri, 01 May 2026 12:00:00 GMT</pubDate></item><item><title>Putting Claude up against our test suite</title><description>&lt;p&gt;I&amp;rsquo;m convinced that in hell, there is a special place dedicated to making engineers fix flaky tests.&lt;/p&gt;
&lt;p&gt;Not broken tests. Not tests covering a real bug. Flaky tests. Tests that pass 999 times out of 1000 and fail on the 1,000th run for no reason you can explain with a clean conscience.&lt;/p&gt;
&lt;p&gt;If you've ever shipped a reasonably complex distributed system, you know exactly what I'm talking about. RavenDB has, at last count, over 32,000 tests that are run continuously on our CI infrastructure. I just checked, and in the past month, we&amp;rsquo;ve had hundreds of full test runs.&lt;/p&gt;
&lt;p&gt;That is actually a problem for our scenario, because with that many tests and that many runs, the law of large numbers starts to apply. Assuming we have tests that have 99.999%&amp;nbsp;reliability, that means that 1 out of every 100,000 test runs may fail. We run tens of millions of those tests in a month.&lt;/p&gt;
&lt;p&gt;In a given week, something between ten and twenty of those tests will fail. Given the number of test runs, that is a good number in percentage terms. But each such failure means that we have to investigate it.&lt;/p&gt;
&lt;p&gt;Those test failures are &lt;em&gt;expensive. &lt;/em&gt;Every ticket is a developer staring at logs, trying to figure out whether this is a genuine bug in the product, a bug in the test itself, or something broken in the environment. In almost all cases, the problem is with the test itself, but we have to investigate.&lt;/p&gt;
&lt;p&gt;A test that consistently fails is easy to fix. A test that occasionally fails is the worst.&lt;/p&gt;
&lt;p&gt;With a flaky test, you don't just fix something and move on. You spend two days isolating it. Reproducing it. Building a mental model of a race condition that only manifests under specific timing, load, and cosmic alignment.&lt;/p&gt;
&lt;p&gt;The tests that do this are almost always the integration tests. The ones that test complex distributed behavior across many parts of the system simultaneously. By definition, they are also the hardest to reason about.&lt;/p&gt;
&lt;p&gt;The fact that, in most cases, those test failures add nothing to the &lt;em&gt;product&lt;/em&gt;&amp;nbsp;(i.e., they didn&amp;rsquo;t actually discover a real bug) is just crushed glass on top of the sewer smoothie. You spend a lot of time trying to find and fix the issue, and there is no real value except that the test now consistently passes.&lt;/p&gt;
&lt;p&gt;We have a script that runs weekly, collects all test failures, and dumps them into our issue tracker. This is routine maintenance hygiene, to make sure we stay in good shape.&lt;/p&gt;
&lt;p&gt;I was looking at the issue tracker when the script ran, and the entire screen lit up with new issues.&lt;/p&gt;
&lt;p&gt;Just looking at that list of new annoyances was enough to ruin my mood.&lt;/p&gt;
&lt;p&gt;And then, without much deliberate planning, I did something dumb and impulsive: I copy-pasted all of those fresh issues into Claude and told it to fix them. Then I went and did other things. I had very low expectations about this, but there was not much to lose.&lt;/p&gt;
&lt;p&gt;A few hours later, I got a notification about a pull request. To be honest, I expected Claude to mark the flaky tests as skipped, or remove the assertions to make them pass.&lt;/p&gt;
&lt;p&gt;I got an &lt;em&gt;actual&lt;/em&gt;&amp;nbsp;pull request, with real fixes, to my shock. Some of them were fixes applied to test logic. Some were actually fixes in the underlying code.&lt;/p&gt;
&lt;p&gt;And then there was this one that stopped me cold. Claude had identified that in one of our test cases, we were waiting on the wrong resource. Not wrong in an obvious way &amp;mdash; wrong in the kind of way that works perfectly 99.9998% of the time and silently fails 0.0002% of the time.&lt;/p&gt;
&lt;p&gt;The (test) code &lt;em&gt;looked&lt;/em&gt;&amp;nbsp;right. We were waiting for something to happen; we just happened to wait on the wrong thing, and usually the value we asserted on was already set by the time we were done waiting.&lt;/p&gt;
&lt;p&gt;Claude found it. In one pass. For the price of a subscription I was already paying. For reference, that &lt;em&gt;single&lt;/em&gt;&amp;nbsp;&amp;ldquo;let me throw Claude at it&amp;rdquo; decision probably saved enough engineering time to cover the cost of Claude for the entire team for that month.&lt;/p&gt;
&lt;p&gt;Let me be precise about what happened and what didn't. Claude did not fix everything. Some of the "fixes" it produced were pretty bad, surface-level patches that didn't address the real cause, or things that were legitimately out of scope.&lt;/p&gt;
&lt;p&gt;You still need an engineer reviewing the output. And you still need judgment.&lt;/p&gt;
&lt;p&gt;But it got things fixed, quickly, without needing two days to context-switch into the problem space. And the things it did fix well, it fixed really well.&lt;/p&gt;
&lt;p&gt;The work it compressed would have realistically taken one developer a week or two to grind through &amp;mdash; and that's assuming you could get a developer to focus on it for that long in the first place. Flaky test investigation is the kind of work that quietly kills team morale.&lt;/p&gt;
&lt;p&gt;Engineers start dreading CI. They start treating red builds as background noise. That's how quality degrades silently. Leaving aside new features or higher velocity, being able to offload the most annoying parts of the job to a machine to do is&amp;hellip; wow.&lt;/p&gt;
&lt;p&gt;Based on this, we're building this into our actual workflow as an integral part of how we handle test maintenance. Failures are collected, routed to Claude, and it takes a first pass at triage and repair. Then we create an issue in the bug tracker with either an &lt;em&gt;actual &lt;/em&gt;fix or a summary of Claude&amp;rsquo;s findings.&lt;/p&gt;
&lt;p&gt;By the time a human reviews this, significant progress has already been made.&lt;/p&gt;
&lt;p&gt;It doesn't replace the engineer. But it means the engineer is doing the interesting part of the work: judgment, review, architectural reasoning. Skipping the part that requires staring at race condition logs until your vision blurs.&lt;/p&gt;
&lt;p&gt;This isn&amp;rsquo;t the most exciting aspect of using a coding agent, I&amp;rsquo;m aware. But it may be one of the best aspects in terms of quality of life.&lt;/p&gt;
</description><link>http://ayende.com/203973-a/putting-claude-up-against-our-test-suite?Key=51ff4d9c-0a4e-4dd4-bbb4-7b697713fc3c</link><guid>http://ayende.com/203973-a/putting-claude-up-against-our-test-suite?Key=51ff4d9c-0a4e-4dd4-bbb4-7b697713fc3c</guid><pubDate>Wed, 29 Apr 2026 12:00:00 GMT</pubDate></item><item><title>15+ years of working with coding agents</title><description>&lt;p&gt;No, the title is not a mistake, nor did I use my time travel pass to give you insights from the future. Bear with me for a moment while I explain my thinking.&lt;/p&gt;&lt;h3&gt;From individual contributor to oversight role&lt;/h3&gt;&lt;p&gt;I started writing RavenDB in a spare bedroom, which turned into an office. The project grew from a sparkle in my head that wouldn&amp;rsquo;t let me sleep into a major project in very short order. &lt;/p&gt;&lt;p&gt;Today, I want to talk about a pretty important stage that happened during that growth phase. Somewhere between having five and ten full-time developers working on RavenDB, I lost the ability to keep track of every single line of code that was going into the project.&lt;/p&gt;&lt;p&gt;I had been the primary developer for years at this point, I wrote the majority of the code, and I was the person making all the key decisions in the project. And then, gradually, I&amp;hellip; wasn&amp;#39;t that guy anymore. &lt;/p&gt;&lt;p&gt;There were too many moving parts, too many developers, too many decisions happening in parallel for me to have my hands on all of it. That was the whole &lt;em&gt;point&lt;/em&gt;&amp;nbsp;of growing the team, dividing the tasks among the team members, and getting good people to do things so I didn&amp;rsquo;t have to do it all myself.&lt;/p&gt;&lt;p&gt;What I didn&amp;#39;t expect was how much it would &lt;em&gt;bother &lt;/em&gt;me. Moving from being the primary developer to a supervisory role didn&amp;rsquo;t mean that I lost the ability to write code. In fact, in many cases, I could &amp;ldquo;see&amp;rdquo; what the solution for each issue should be.&lt;/p&gt;&lt;p&gt;I just didn&amp;rsquo;t have the &lt;em&gt;time&lt;/em&gt;&amp;nbsp;to do that, nor the capacity to sit with every single developer on every single issue and craft the right way to solve it. I&amp;#39;d hand a feature to a developer &lt;em&gt;know&lt;/em&gt;&lt;em&gt;ing&lt;/em&gt;&amp;nbsp;that the way they were going to handle it would not be&amp;nbsp;mine. &lt;/p&gt;&lt;p&gt;That doesn&amp;rsquo;t mean it would be wrong, but it wouldn&amp;rsquo;t be the same. It might need a review cycle or two to get to the right level for the product, or they wouldn&amp;rsquo;t consider how it fits into the grand scheme of things, etc. &lt;/p&gt;&lt;p&gt;And let&amp;rsquo;s not talk about the time estimates I got. I&amp;rsquo;m willing to assume that my personal timing estimates are highly subjective and influenced by my deep familiarity with the codebase. &lt;/p&gt;&lt;p&gt;But still. Multiple days for something that felt like it &lt;em&gt;should &lt;/em&gt;be a two-hour job was hard to sit with.&lt;/p&gt;&lt;p&gt;I carried around a background level of frustration for quite some time. It killed me that the pace of development wasn&amp;rsquo;t up to what I wanted it to be. &amp;ldquo;If I could just have the time to sit and write this&amp;rdquo;, I kept thinking, &amp;ldquo;we would be done by the end of the week.&amp;rdquo; &lt;/p&gt;&lt;p&gt;There &lt;em&gt;was&lt;/em&gt;&amp;nbsp;progress, to be clear, but nothing was moving fast enough. Everywhere I looked, we had stalled. &lt;/p&gt;&lt;p&gt;And then something happened. It didn&amp;rsquo;t happen all at once, but in the space of a month or two, features started to land. Each team had been heads-down on something for quite a while, and by some coincidence of timing, they all finished around the same time. &lt;/p&gt;&lt;p&gt;Suddenly, we moved from &amp;ldquo;we have nothing to ship&amp;rdquo; to &amp;ldquo;we &lt;em&gt;can&amp;rsquo;t &lt;/em&gt;have so many new features all at once&amp;rdquo;. I realized that I &lt;em&gt;would&lt;/em&gt;&amp;nbsp;be able to ship things faster, for sure. I could do two new features, maybe even three, in that same time frame. That would require head-down coding for the entire duration, of course.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Reading that last paragraph again, I have to admit that I may be letting some hubris color my perception &amp;#129335;&amp;#128527;. &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;I wouldn&amp;rsquo;t be able to deliver the sheer quantity of features that the team was able to deliver. &lt;/p&gt;&lt;p&gt;What had felt like months of stagnation turned out to be parallelism in action.&lt;/p&gt;&lt;p&gt;Yes, some of the code wasn&amp;#39;t the same code that I would write. And some of the architectural decisions weren&amp;#39;t the ones I&amp;#39;d have made. That didn&amp;rsquo;t make them &lt;em&gt;wrong&lt;/em&gt;, mind. And those developers were working on things &lt;em&gt;I &lt;/em&gt;was not working on. And the sum total of what got built was something I could never have done solo.&lt;/p&gt;&lt;h3&gt;Treating coding agents as junior developers? &lt;/h3&gt;&lt;p&gt;I think about that experience constantly now, because I&amp;#39;m living a version of it again, except the new team member is Claude. Working with AI coding agents today feels remarkably like working with a junior developer who is also a savant. &lt;/p&gt;&lt;p&gt;They&amp;#39;ve read everything. They know an enormous amount. They can produce working code quickly and confidently across a staggering range of domains. And yet they&amp;#39;re also genuinely ignorant in ways that will surprise you: missing context, misreading intent, optimizing for the wrong thing, occasionally producing something that is confidently and completely broken.&lt;/p&gt;&lt;p&gt;This is not a criticism. This is just what it&amp;#39;s like. And I&amp;#39;ve dealt with this before. There are clear parallels between mentoring junior engineers and looking at the output from an AI agent. &lt;/p&gt;&lt;p&gt;There is an assumption that you need to get perfect output from a coding agent. But you are not likely to get perfect output from a human developer. Even experienced developers benefit greatly from reviews, guidance, etc. Junior developers need &lt;em&gt;more &lt;/em&gt;of that, of course, but they can still bring value, even if their output goes through several iterations.&lt;/p&gt;&lt;p&gt;For coding agents to bring real value, you need to consider them in the same light.&lt;/p&gt;&lt;p&gt;The shift that happened with my developer team is the same shift that&amp;#39;s happening now with AI agents.&lt;/p&gt;&lt;p&gt;Instead of writing every line yourself, you start spending time on the bigger picture: here&amp;#39;s the overall direction, here&amp;#39;s the architectural constraint, here&amp;#39;s what done looks like. Then you review the outputs. &lt;/p&gt;&lt;p&gt;Talking to a coding agent is a little different from discussing a feature with a dev and reviewing their code days later, except that the agent delivers the output in the time it takes to get coffee.&lt;/p&gt;&lt;p&gt;The fact that this cycle is done in a short amount of time means that you still have all the knowledge in your head. You can catch drift before it becomes technical debt. &lt;/p&gt;&lt;p&gt;The &lt;em&gt;cost&lt;/em&gt;&amp;nbsp;of going in the wrong direction is greatly reduced, which means that you can be far more radical about how you approach these tasks.&lt;/p&gt;&lt;h3&gt;Unnatural impulses as a developer&lt;/h3&gt;&lt;p&gt;I wonder if a lot of developers are facing challenges in this area specifically because they don&amp;rsquo;t have the managerial experience needed for this new aspect of the work. &lt;/p&gt;&lt;p&gt;I have been writing code with Claude recently. And the short feedback cycle means that I&amp;rsquo;m loving it. I&amp;#39;m not abdicating the technical judgment, mind. I&amp;#39;m applying it differently. &lt;/p&gt;&lt;p&gt;I&amp;#39;m writing the high-level design, not the implementation. I&amp;#39;m doing the review, not the first draft. And I&amp;#39;m being honest with myself that the output, while it isn&amp;rsquo;t always what &lt;em&gt;I &lt;/em&gt;would write, is covering ground I simply would not have covered otherwise.&lt;/p&gt;&lt;p&gt;I have been doing this for a long time and it feels quite natural. I also remember that this was a &lt;em&gt;difficult&lt;/em&gt;&amp;nbsp;transition for me at the time. &lt;/p&gt;&lt;p&gt;For those who want to better understand how they can get the most value from coding agents, you are probably better off looking into project management theory rather than optimizing your &lt;code&gt;agents.md&lt;/code&gt;&amp;nbsp;file.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203972-a/15-years-of-working-with-coding-agents?Key=0c842282-4ab8-41dd-978d-f26f0e80df59</link><guid>http://ayende.com/203972-a/15-years-of-working-with-coding-agents?Key=0c842282-4ab8-41dd-978d-f26f0e80df59</guid><pubDate>Mon, 27 Apr 2026 12:00:00 GMT</pubDate></item><item><title>Expertise in the age of AI, or: Matt's Claude'll handle this</title><description>&lt;p&gt;One of our team leads has been working on a major feature using Claude Code. He&amp;#39;s been at it for a few days and is nearly done. To put that in context: this feature would normally represent about a month of a senior developer&amp;#39;s time.&lt;/p&gt;&lt;p&gt;He did the backend work himself &amp;mdash; working with Claude to build it out, applying his knowledge of how the system should behave, reviewing, adjusting, and iterating. He handled only the backend, and when I asked him about the frontend, he said: &lt;em&gt;&amp;quot;I&amp;#39;m going to let Matt&amp;rsquo;s Claude handle that.&amp;quot;&lt;/em&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Context: Matt is the frontend team lead. &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Note the interesting phrasing. He didn&amp;#39;t say &amp;quot;I&amp;#39;ll do the UI later&amp;quot; or &amp;quot;Claude&amp;rsquo;ll handle the UI.&amp;quot; He deferred to the frontend lead who has the domain expertise to drive that part.&lt;/p&gt;&lt;p&gt;That&amp;#39;s not a throwaway comment. That&amp;#39;s an &lt;em&gt;important&lt;/em&gt;&amp;nbsp;statement about how work should be divided in the age of AI agents.&lt;/p&gt;&lt;p&gt;Here&amp;#39;s the thing: I&amp;#39;ve told Claude to build a UI for a feature, pointed it at the codebase, and it figured out how the frontend is structured, what patterns we use, and generated something I could work with. It wasn&amp;rsquo;t a sketch or a wireframe diagram, it was actually &lt;em&gt;usable&lt;/em&gt;. &lt;/p&gt;&lt;p&gt;I got a functional UI from Claude in less time than it would take to write up the issue describing what I want.&lt;/p&gt;&lt;p&gt;That UI was enough for me to explore the feature, do a small demo, etc. I&amp;rsquo;m not a frontend guy, and I didn&amp;rsquo;t even look at the code, but I assume that the output probably matched the rest of our frontend code. &lt;/p&gt;&lt;p&gt;We won&amp;rsquo;t be using the UI Claude generated for me, though. The gap in polish between what I got and what a real frontend developer produces is enormous. I got something I could play with, but it was very evident that it wasn&amp;rsquo;t something that had received real attention.&lt;/p&gt;&lt;p&gt;For the time being, it was more than sufficient. The problem is that&amp;nbsp;even leaning heavily on AI, the investment of time for me to do it &lt;em&gt;right&lt;/em&gt;&amp;nbsp;would be significant. I&amp;#39;d need to understand our frontend architecture, our conventions, our component library, how state flows, and what our designers expect. All of that would take real time, even with an AI doing most of the code generation.&lt;/p&gt;&lt;p&gt;That is leaving aside the things that I &lt;em&gt;don&amp;rsquo;t&lt;/em&gt;&amp;nbsp;know about frontend that I wouldn&amp;rsquo;t even realize I need to handle. I wouldn&amp;rsquo;t even know what to ask the AI about, even if it could do the right thing if I sent it the right prompt.&lt;/p&gt;&lt;p&gt;Contrast that with the frontend team. They &lt;em&gt;know&lt;/em&gt;&amp;nbsp;the architecture of the frontend, of course, and they know how things should slot together and what concerns they should address. They know when Claude&amp;#39;s suggestion is on the right track and when it&amp;#39;s going to create a mess three layers down. Effectively, they know the magic incantation that the agent needs in order to do the right thing. &lt;/p&gt;&lt;p&gt;What does this &lt;em&gt;say&lt;/em&gt;&amp;nbsp;about AI usage in general? Given two people with the same access to a smart coding agent like Claude or Codex, both performing the same task, their domain knowledge will lead to &lt;em&gt;very&lt;/em&gt;&amp;nbsp;different results. In other words, it means that Claude and its equivalents are &lt;em&gt;tools&lt;/em&gt;. And the wielder of the tool has a huge impact on the end result.&lt;/p&gt;&lt;p&gt;The role of expertise hasn&amp;#39;t diminished. It&amp;#39;s shifted. The expert is no longer the person who can produce the artifact. They&amp;#39;re the person who can &lt;em&gt;direct the production&lt;/em&gt;&amp;nbsp;of the artifact correctly and efficiently. That&amp;#39;s a different skill profile, but it&amp;#39;s no less valuable and the leverage is higher.&lt;/p&gt;&lt;p&gt;We&amp;#39;re still figuring out what this means structurally. But the instinct to say &amp;quot;that&amp;#39;s not my domain, let the person who knows it handle the AI that does it&amp;quot; is correct. Domain knowledge determines the quality of the output, even when the AI is doing all the typing.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203971-a/expertise-in-the-age-of-ai-or-matts-claudell-handle-this?Key=5cdca447-6773-4a90-8564-4765289ec644</link><guid>http://ayende.com/203971-a/expertise-in-the-age-of-ai-or-matts-claudell-handle-this?Key=5cdca447-6773-4a90-8564-4765289ec644</guid><pubDate>Thu, 23 Apr 2026 12:00:00 GMT</pubDate></item><item><title>Using AI agents in long-lived software projects</title><description>&lt;p&gt;You read the story a hundred times: &amp;ldquo;I told Codex (or Claude, or Antigravity, etc.) to build me a full app to run my business, and 30 minutes later, it&amp;rsquo;s done&amp;rdquo;. These types of stories usually celebrate the new ecosystem and the ability to build complex systems without having to dive into the details.&lt;/p&gt;&lt;p&gt;The benchmarks celebrate &amp;quot;one-shotting&amp;quot; entire applications, as if that&amp;#39;s the relevant metric. I think this is the wrong framing entirely. Mostly because I care very little about disposable software, stuff that you stop using after a few days or a week. I work on projects whose lifetime is measured in decades. &lt;/p&gt;&lt;p&gt;AI agent-driven development isn&amp;#39;t about the ability to use a one-shot prompt to generate a full-blown app that matches &lt;em&gt;exactly&lt;/em&gt;&amp;nbsp;what the user wants. That is a nice trick, but nothing more, because after you generate the application, you need to maintain it, add features (and ensure stability over time), fix bugs, and adjust what you have.&lt;/p&gt;&lt;p&gt;The process of using AI agents to build long-lived applications is distinctly different from what I see people bandying about. I want to dedicate this post to discussing some aspects of using AI agents to accelerate development in long-lived software projects. &lt;/p&gt;&lt;h2&gt;Code quality only matters in the long run&lt;/h2&gt;&lt;p&gt;The key difference between one-off work and long-lived systems is that we don&amp;rsquo;t care about code quality &lt;em&gt;at all&lt;/em&gt;&amp;nbsp;for the one-off stuff. It&amp;#39;s a throwaway artifact. Run it, get your answer, move on. I am usually not even going to &lt;em&gt;look&lt;/em&gt;&amp;nbsp;at the code that was generated; I certainly don&amp;rsquo;t care how it is structured.&lt;/p&gt;&lt;p&gt;If I need to make any changes, or have to come back to it in six months, it is usually easier to just regenerate the whole thing from scratch rather than trying to maintain or evolve it.&lt;/p&gt;&lt;p&gt;When you&amp;#39;re talking about an application that will live for a decade or more - or worse, an &lt;em&gt;existing&lt;/em&gt;&amp;nbsp;application with decades of accumulated effort baked into it - what happens then? The calculus changes completely. How do you even begin to bring AI into that kind of system?&lt;/p&gt;&lt;p&gt;It turns out that proper software architecture becomes &lt;em&gt;more&lt;/em&gt;&amp;nbsp;relevant, not less.&lt;/p&gt;&lt;h2&gt;Software architecture as context management for AI&lt;/h2&gt;&lt;p&gt;Think about what good software architecture actually gives you: components, layers, clear boundaries, and well-defined responsibilities. The traditional justification is that this lets you make small, careful, targeted changes. You know where to go, and you can change one thing. You slowly evolve things over time. Your changes don&amp;#39;t break ten others because not everything is intermingled. &lt;/p&gt;&lt;p&gt;Now think about how an AI operates on a codebase. It works within a context window. That constraint isn&amp;#39;t unique to AI, people do that too. There is only so much you can keep in your head, and proper architecture means that you are separating concerns so you can work with just the relevant details in mind. &lt;/p&gt;&lt;p&gt;When your architecture is clean, the AI can focus on exactly the right piece of the system. When it isn&amp;#39;t, you&amp;#39;re either feeding the AI irrelevant noise or hiding the context it actually needs from it.&lt;/p&gt;&lt;p&gt;Good architecture, it turns out, is also a good AI interface. And the reason this works is the same as for people: it reduces the cognitive load you have to carry while understanding and modifying the system. For AI, we just call it the context window. For people, it is cognitive load. Same term, same concept. &lt;/p&gt;&lt;p&gt;Beyond the mechanical benefits, good architecture gives you two things that I think are underappreciated in this conversation.&lt;/p&gt;&lt;p&gt;The first is &lt;em&gt;structural comprehension&lt;/em&gt;. You don&amp;#39;t need to have every line of a large codebase in your head. But you do need a genuine mental model of how data flows, how components relate, and where things live. That&amp;#39;s only possible if the architecture actually reflects the system&amp;#39;s intent. &lt;/p&gt;&lt;p&gt;When using AI to generate code, you &lt;em&gt;need&lt;/em&gt;&amp;nbsp;to have a proper understanding of the flow of the system. That allows you to look at a pull request and understand the changes, their intent, and how they fit into the greater whole. Without that, you can&amp;#39;t meaningfully review the code. You&amp;#39;re just rubber-stamping diffs you don&amp;#39;t have a hope of understanding.&lt;/p&gt;&lt;p&gt;The second is that &lt;em&gt;the work has shifted&lt;/em&gt;. We&amp;#39;re moving from &amp;quot;how do I write this code?&amp;quot; to &amp;quot;how do I review all of this code?&amp;quot;. Nobody is going to meaningfully maintain 30,000 lines a day of dense AI code. At that point, the codebase has escaped human comprehension, and you&amp;#39;ve &lt;em&gt;lost&lt;/em&gt;the game. This isn&amp;rsquo;t your project anymore, and sooner or later, you&amp;rsquo;ll face the Big Decision.&lt;/p&gt;&lt;h2&gt;Turtles all the way down&lt;/h2&gt;&lt;p&gt;I hear the proposed solution constantly: &amp;quot;I have an agent that writes the code, an agent that tests it, an agent that reviews the reviews, and so on.&amp;quot; This is, I think, genuinely insane for anything that matters.&lt;/p&gt;&lt;p&gt;We already have evidence from the field that this doesn&amp;rsquo;t work. &lt;a href="https://www.digitaltrends.com/computing/ai-code-wreaked-havoc-with-amazon-outage-and-now-the-company-is-making-tight-rules/"&gt;Amazon has had production failures from AI-generated code&lt;/a&gt;&amp;nbsp;produced through exactly these kinds of layered-AI pipelines. Microsoft&amp;#39;s aggressive approach to AI integration has shown what happens when &lt;a href="https://www.digitaltrends.com/computing/from-microsoft-to-microslop-the-ai-backlash-that-forced-a-reset/"&gt;AI-generated code enters production with minimal meaningful human oversight&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;In both of those cases, the &amp;ldquo;proper oversight&amp;rdquo; was also provided by AI. And the end result wasn&amp;rsquo;t encouraging for this pattern of behavior. For critical systems that carry &lt;a href="https://dev.to/tyson_cung/amazon-lost-63m-orders-after-ai-coding-tool-went-rogue-now-theyre-hitting-the-brakes-2h7p"&gt;real consequences&lt;/a&gt;, &amp;quot;AI supervising AI&amp;quot; is not a thing.&lt;/p&gt;&lt;p&gt;AI works when you treat it as a tool in your hands, not as an autonomous system you&amp;#39;ve delegated to. An engineer who understands architecture and can look at a diff and say &amp;quot;this is right&amp;quot; or &amp;quot;this is wrong, and here&amp;#39;s why&amp;quot; is &lt;em&gt;much &lt;/em&gt;more capable with AI than without it. &lt;/p&gt;&lt;p&gt;An engineer who has offloaded comprehension to the machine is flying blind; worse, they are flying very fast directly into a cliff wall. &lt;/p&gt;&lt;h2&gt;What should you do about it?&lt;/h2&gt;&lt;p&gt;When we treat AI agents as a tool, it turns out that not all that much &lt;em&gt;needs&lt;/em&gt;&amp;nbsp;to change. The current processes you have in place (CI/CD, testing, review cycles, etc.) are all about being able to &lt;em&gt;generate trust&lt;/em&gt;&amp;nbsp;in the new code being written. Whether a human wrote it or a GPU did is less interesting.&lt;/p&gt;&lt;p&gt;At the same time, we have decades of experience building big systems. We know that a Big Ball of Mud isn&amp;rsquo;t sustainable. We know that proper architecture means breaking the system into digestible chunks. Yes, with AI you can throw everything together, and it will sort of work for a surprisingly long time. Until it doesn&amp;rsquo;t.&lt;/p&gt;&lt;p&gt;With a proper architecture, the scope you need to keep track of is inherently limited. That allows you to evolve over time and make changes that are inherently limited in scope (thus, reviewable, actionable, etc.).&lt;/p&gt;&lt;p&gt;&amp;ldquo;The more things change, the more they stay the same.&amp;rdquo; It is a nice saying, but it also carries a fundamental truth. Using AI doesn&amp;rsquo;t absolve us from the realities on the ground, after all.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203940-c/using-ai-agents-in-long-lived-software-projects?Key=ba47e46e-bfb5-454a-ad3e-178ebc501c01</link><guid>http://ayende.com/203940-c/using-ai-agents-in-long-lived-software-projects?Key=ba47e46e-bfb5-454a-ad3e-178ebc501c01</guid><pubDate>Tue, 21 Apr 2026 12:00:00 GMT</pubDate></item><item><title>Agents, Code Reviews, and the Bottleneck Shift, Oh My!</title><description>&lt;p&gt;Like everything else, we have been using AI in various forms for a while now, from asking ChatGPT to write a function to asking it to explain an error, then graduating to running it on our code in the IDE, and finally to full-blown independent coding assistants.&lt;/p&gt;
&lt;p&gt;Recently, we shifted into a much higher gear, rolling it out across most of the teams at RavenDB. I want to talk specifically about what that looks like in practice in real production software.&lt;/p&gt;
&lt;p&gt;RavenDB is a mature codebase, with about 18 years of history behind it. The core team is a few dozen developers working on this full-time. We also care &lt;em&gt;very&lt;/em&gt;&amp;nbsp;deeply about correctness, performance, and maintainability.&lt;/p&gt;
&lt;p&gt;With all the noise about Claude, Codex, and their ilk recently, we decided to run some experiments to see how we can leverage them to help us build RavenDB.&lt;/p&gt;
&lt;h2&gt;The numbers that got my attention&lt;/h2&gt;
&lt;p&gt;We started with features that were relatively self-contained &amp;mdash; ambitious enough to be real work, but isolated enough that an AI agent could take them end-to-end without stepping on core aspects of RavenDB.&lt;/p&gt;
&lt;p&gt;The first one was estimated at about a month of work for a senior developer. We completed it in two days. To be fair, a significant portion of that time was spent learning how to work effectively with Claude as an agent, learning the ropes and the right discipline and workflows, not just the task itself.&lt;/p&gt;
&lt;p&gt;The second was estimated at roughly three months for an initial version. It was delivered in about a week. And we didn't just hit the target &amp;mdash; we significantly exceeded the planned feature set.&lt;/p&gt;
&lt;p&gt;In terms of efficiency, we are talking about a proper &lt;em&gt;leap&lt;/em&gt;&amp;nbsp;from what we previously could expect.&lt;/p&gt;
&lt;h2&gt;This isn't vibe coding&lt;/h2&gt;
&lt;p&gt;I want to be direct about something: this is not "prompt it and ship it." There is a discipline required here. The AI can move very fast, explore a lot of ground, and generate code that looks right, but isn&amp;rsquo;t. Code ownership and engineering responsibility don't go away; they become much more demanding.&lt;/p&gt;
&lt;p&gt;I personally sat and read 30,000 lines of code. I had to understand what was there, push back on decisions, redirect the approach, and enforce the standards that RavenDB has built up over many years.&lt;/p&gt;
&lt;p&gt;Those 30,000 lines of code didn&amp;rsquo;t appear out of thin air. They were the final result of a &lt;em&gt;lot&lt;/em&gt;&amp;nbsp;of planning, back and forth with the agent, incremental steps in the right direction (and many wrong ones, etc.).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To be fair, 30,000 lines of code sounds like a &lt;em&gt;lot&lt;/em&gt;, right? About 60% of that is actually tests, and about half of the remaining code is boilerplate infrastructure that we need to have, but isn&amp;rsquo;t really interesting.&lt;/p&gt;
&lt;p&gt;The juicy parts are only around 5,000 lines or so.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In many respects, this isn&amp;rsquo;t prompt-and-go but feels a lot more like a pair programming session on steroids.&lt;/p&gt;
&lt;p&gt;What AI agents give you is the ability to explore the problem space cheaply and quickly. After we had something built, I had a different idea about how to go about implementing it. So I asked it to do that, and it gave me something that I could actually &lt;em&gt;explore&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Being able to evaluate multiple different approaches to a solution is &lt;em&gt;crazy&lt;/em&gt;&amp;nbsp;valuable.&amp;nbsp;It is transformative for architectural decisions.&lt;/p&gt;
&lt;p&gt;Having said that, using a coding agent to take all the boilerplate stuff meant that I was able to focus on the &amp;ldquo;fun parts&amp;rdquo;, the pieces that actually add the most value, not everything else that I need to do to get to that part.&lt;/p&gt;
&lt;h2&gt;What this means going forward&lt;/h2&gt;
&lt;p&gt;AI agents are going to amplify your existing engineering culture, for better or worse.&lt;/p&gt;
&lt;p&gt;A lot of the cost of writing good software is going to move from actually writing code to reviewing it. For many people, the act of writing the code was also the part where they &lt;em&gt;thought&lt;/em&gt;&amp;nbsp;about it most deeply.&lt;/p&gt;
&lt;p&gt;Now the thinking part moves either upfront, at the planning phase, or to the end, when you look at the pull request. Reading a pull request, you could reasonably expect to see code that has already been reasoned about and properly tamed.&lt;/p&gt;
&lt;p&gt;Now, in some cases, this is the first time that a human is actually going to properly walk through the whole thing. To ensure proper quality, you also need to shift a lot of your focus to that part.&lt;/p&gt;
&lt;p&gt;The bottleneck for good software is going to be the review cycle, the architectural approach, and an experienced team that can actually evaluate the output and ensure consistent high quality.&lt;/p&gt;
&lt;p&gt;Without that, you can go very fast, but just generating code quickly is a losing proposition. You&amp;rsquo;ll go very fast directly into a painful collision with a wall.&lt;/p&gt;
&lt;p&gt;We are still settling down and trying to properly understand the best approach to take, but I have to say that this experiment was a major success.&lt;/p&gt;
</description><link>http://ayende.com/203939-c/agents-code-reviews-and-the-bottleneck-shift-oh-my?Key=a4aac51e-45ff-426d-8340-9c2056e743f0</link><guid>http://ayende.com/203939-c/agents-code-reviews-and-the-bottleneck-shift-oh-my?Key=a4aac51e-45ff-426d-8340-9c2056e743f0</guid><pubDate>Fri, 17 Apr 2026 12:00:00 GMT</pubDate></item><item><title>The 'Million AI Monkeys' Hypothesis &amp; Real-World Projects</title><description>&lt;p&gt;I have run into &lt;a href="https://x.com/johnrushx/status/2026961833723113782?s=52"&gt;this post&lt;/a&gt;&amp;nbsp;by John Rush, which I found really interesting, mostly because I so vehemently disagree with it. Here are the points that I want to address in John&amp;rsquo;s thesis:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;1. Open&amp;nbsp;Source movement gonna&amp;nbsp;end because AI can rewrite any oss repo into a new code and commercially redistribute it as their own.&lt;/p&gt;&lt;p&gt;2. Companies gonna use AI to generate their none core software as a marketing effort (cloudflare rebuilt nextjs&amp;nbsp;in &amp;nbsp;a week).&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;em&gt;Can&lt;/em&gt;&amp;nbsp;AI rewrite an OSS repo into new code? Let&amp;rsquo;s dig into this a little bit.&lt;/p&gt;&lt;p&gt;AI models today do a &lt;em&gt;great&lt;/em&gt;&amp;nbsp;job of translating code from one language to another. We have good testimonies that this is actually a pretty useful scenario, such as the recent translation of the &lt;a href="https://ladybird.org/posts/adopting-rust/"&gt;Ladybird JS engine to Rust&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;At RavenDB, we have been using that to manage our client APIs (written in multiple languages &amp;amp; platforms). It has been a great help with that.&lt;/p&gt;&lt;p&gt;But that is fundamentally the same as the &lt;a href="https://web.archive.org/web/20081205075009/https://msdn.microsoft.com/en-us/vstudio/aa718346.aspx"&gt;Java to C# converter&lt;/a&gt;&amp;nbsp;that shipped with Visual Studio 2005. That is 2005, not 2025, mind you. The link above is to the Wayback Machine because the original link itself is lost to history. &lt;/p&gt;&lt;p&gt;AI models do a much better job here, but they aren&amp;rsquo;t bringing something new to the table in this context. &lt;/p&gt;&lt;h2&gt;Claude C Compiler&lt;/h2&gt;&lt;p&gt;Now, let&amp;rsquo;s talk about using the model to replicate a project from scratch. And here we have a bunch of examples. There is the Claude C Compiler, an impressive feat of engineering that can compile the Linux kernel. &lt;/p&gt;&lt;p&gt;Except&amp;hellip; it is a proof of concept that you wouldn&amp;rsquo;t &lt;em&gt;want&lt;/em&gt;&amp;nbsp;to use. It produces code that is significantly slower than GCC, and its output is not something that you can trust. And it is not in a shape to be a long-term project that you would maintain over the years. &lt;/p&gt;&lt;p&gt;For a young project, being slower than the best-of-breed alternative is not a bad thing. You&amp;rsquo;ve shown that your project works; now you can work on optimization. &lt;/p&gt;&lt;p&gt;For an AI project, on the other hand, you are in a pretty bad place. The key here is in terms of long-term maintainability. There is &lt;a href="https://www.modular.com/blog/the-claude-c-compiler-what-it-reveals-about-the-future-of-software"&gt;a great breakdown of the Claude C Compiler from the creator of Clang&lt;/a&gt;&amp;nbsp;that I highly recommend reading.&lt;/p&gt;&lt;p&gt;The amount of work it would require to turn it into actual production-level code is &lt;em&gt;enormous&lt;/em&gt;. I think that it would be fair to say that the overall cost of building a production-level compiler with AI would be in the same ballpark as writing one directly.&lt;/p&gt;&lt;p&gt;Many of the issues in the Claude C Compiler are not bugs that you can &amp;ldquo;just fix&amp;rdquo;. They are deep architectural issues that require a very different approach. &lt;/p&gt;&lt;p&gt;Leaving that aside, let&amp;rsquo;s talk about the actual use case. The Linux kernel&amp;rsquo;s relationship with its compiler is not a trivial one. Compiler bugs and behaviors are routine issues that developers run into and need to work on. &lt;/p&gt;&lt;p&gt;See the occasional &amp;ldquo;discussion&amp;rdquo; on undefined behavior optimizations by the compiler for surprisingly straightforward code. &lt;/p&gt;&lt;h1&gt;Cloudflare&amp;rsquo;s vinext&lt;/h1&gt;&lt;p&gt;So Cloudflare &lt;a href="https://blog.cloudflare.com/vinext/"&gt;rebuilt Next.js in a week using AI&lt;/a&gt;. That is pretty impressive, but that is also a lie. They might have done &lt;em&gt;some&lt;/em&gt;&amp;nbsp;work in a week, but that isn&amp;rsquo;t something that is ready. Cloudflare is directly calling this highly experimental (very rightly so).&lt;/p&gt;&lt;p&gt;They also have several customers using it in production already. That is awesome news, except that within literal days of this announcement, &lt;a href="https://x.com/rauchg/status/2026864132423823499"&gt;multiple critical vulnerabilities have been found in this project&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;A new project having vulnerabilities is not unexpected. But some of those vulnerabilities were &lt;a href="https://x.com/samwcyo/status/2026888257779224594"&gt;literal copies of (fixed) vulnerabilities in the original&lt;/a&gt;&amp;nbsp;Next.js project. &lt;/p&gt;&lt;p&gt;The issue here is the pace of change and the impact. If it takes an agent a week to build a project and then you throw that into production, how much real testing has been done on it? How much is that code &lt;em&gt;worth&lt;/em&gt;? &lt;/p&gt;&lt;p&gt;John stated that this vinext&amp;nbsp;project for Cloudflare was a marketing effort. I have to note that they had to pay bug bounties as a result and exposed their customers to higher levels of risk. I don&amp;rsquo;t consider that a plus. There is also now the ongoing maintenance cost to deal with, of course. &lt;/p&gt;&lt;p&gt;The key here is that a line of code is not something that you look at in isolation. You need to look at its totality. Its history, usage, provenance, etc. A line of code in a project that has been battle-tested in production is &lt;em&gt;far&lt;/em&gt;&amp;nbsp;more valuable than a freshly generated one.&lt;/p&gt;&lt;p&gt;I&amp;rsquo;ll refer again to the awesome &lt;a href="https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/"&gt;&amp;ldquo;Things You Should Never Do&amp;rdquo; from Spolsky&lt;/a&gt;. That is over 25 years old and is &lt;em&gt;still &lt;/em&gt;excellent advice, even in the age of AI-generated code.&lt;/p&gt;&lt;h1&gt;NanoClaw&amp;rsquo;s approach&lt;/h1&gt;&lt;p&gt;You&amp;rsquo;ve probably heard about the Clawdbot &amp;rArr; Moltbot &amp;rArr; &lt;a href="https://openclaw.ai/"&gt;OpenClaw&lt;/a&gt;, a way to plug AI directly into everything and give your CISO a heart attack. That is an interesting story, but from a technical perspective, I want to focus on what it &lt;em&gt;does&lt;/em&gt;.&lt;/p&gt;&lt;p&gt;A key part of what made OpenClaw successful was the number of integrations it has. You can connect it to Telegram, WhatsApp, Discord, and more. You can plug it into your Gmail, Notes, GitHub, etc.&lt;/p&gt;&lt;p&gt;It has about half a million lines of code (TypeScript), which were mostly generated by AI as well.&lt;/p&gt;&lt;p&gt;To contrast that, we have &lt;a href="https://nanoclaw.net/"&gt;NanoClaw&lt;/a&gt;&amp;nbsp;with ~500 lines of code. Not a typo, it is roughly a &lt;em&gt;thousand &lt;/em&gt;times smaller than OpenClaw. The key difference between these two projects is that NanoClaw rebuilds itself on the fly.&lt;/p&gt;&lt;p&gt;If you want to integrate with Telegram, for example, NanoClaw will use the AI model to &lt;em&gt;add the Telegram integration&lt;/em&gt;. In this case, it will use pre-existing code and use the model as a weird plugin system. But it also has the ability to &lt;em&gt;generate&lt;/em&gt;&amp;nbsp;new code for integrations it doesn&amp;rsquo;t already have. &lt;a href="https://deepwiki.com/gavrielc/nanoclaw/8.3-customize-skill-(customize)"&gt;See here for more details&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;On the one hand, that is a pretty neat way to reduce the overall code in the project. On the other hand, it means that each user of NanoClaw will have their own &lt;em&gt;bespoke&lt;/em&gt;&amp;nbsp;system.&lt;/p&gt;&lt;p&gt;Contrasting the OpenClaw and NanoClaw approaches, we have an interesting problem. Both of those systems are primarily built with AI, but NanoClaw is likely going to show a lot more variance in what is actually running on your system.&lt;/p&gt;&lt;p&gt;For example, if I want to use Signal as a communication channel, OpenClaw has that built in. You can integrate Signal into NanoClaw as well, but it will generate code (using the model) for this integration &lt;em&gt;separately&lt;/em&gt;&amp;nbsp;for each user who needs it.&lt;/p&gt;&lt;p&gt;A bespoke solution for each user may &lt;em&gt;sound&lt;/em&gt;&amp;nbsp;like a nice idea, but it just means that each NanoClaw is its own special snowflake. Just thinking about supporting something like that across many users gives me the shivers. &lt;/p&gt;&lt;p&gt;For example, &lt;a href="https://www.oasis.security/blog/openclaw-vulnerability"&gt;OpenClaw had an agent takeover vulnerability&lt;/a&gt;&amp;nbsp;(reported literally yesterday) that would allow a simple website visit to completely own the agent (with all that this implies). OpenClaw&amp;rsquo;s design means that it can be fixed in a single location.&lt;/p&gt;&lt;p&gt;NanoClaw&amp;rsquo;s design, on the other hand, means that for each user, there is a slightly different implementation, which may or may not be vulnerable. And there is no really good way to actually fix this.&lt;/p&gt;&lt;h1&gt;Summary&lt;/h1&gt;&lt;p&gt;The idea that you can just throw AI at a problem and have it generate code that you can then deploy to production is an attractive one. It is also by no means a new one. &lt;/p&gt;&lt;p&gt;The notion of &lt;a href="https://en.wikipedia.org/wiki/Computer-aided_software_engineering"&gt;CASE tools&lt;/a&gt;&amp;nbsp;used to be the way to go about it. The book &lt;a href="https://www.amazon.com/Application-Development-Without-Programmers-Martin/dp/0130389439/"&gt;Application Development Without Programmers&lt;/a&gt;&amp;nbsp;was published in 1982, for example. The world has changed since then, but we are still trying to get rid of programmers.&lt;/p&gt;&lt;p&gt;Generating code quickly is easy these days, but that just shifts the burden. The cost of &lt;em&gt;verifying&lt;/em&gt;&amp;nbsp;code has become a lot more pronounced. Note that I didn&amp;rsquo;t say expensive. It used to be the case that writing the code and verifying it were almost the same task. You wrote the code and thus had a human verifying that it made sense. Then there are the other review steps in a proper software lifecycle.&lt;/p&gt;&lt;p&gt;When we can drop 15,000 lines of code in a few minutes of prompting, the entire story changes. The value of a line of code on its own approaches zero. The value of a &lt;em&gt;reviewed&lt;/em&gt;&amp;nbsp;line of code, on the other hand, hasn&amp;rsquo;t changed.&lt;/p&gt;&lt;p&gt;A line of code from a battle-tested, mature project is infinitely more valuable than a newly generated one, regardless of how quickly it was produced. The cost of generating code approaches zero, sure.&lt;/p&gt;&lt;p&gt;But newly generated code isn&amp;rsquo;t &lt;em&gt;useful&lt;/em&gt;. In order for me to actually make use of that, I need to verify it and ensure that I can trust it. More importantly, I need to know that I can &lt;em&gt;build&lt;/em&gt;&amp;nbsp;on top of it. &lt;/p&gt;&lt;p&gt;I don&amp;rsquo;t see a lot of people paying attention to the concept of long-term maintainability for projects. But that is key. Otherwise, you are signing up upfront to be a legacy system that no one understands or can properly operate.&lt;/p&gt;&lt;p&gt;Production-grade software isn&amp;rsquo;t a prompt away, I&amp;rsquo;m afraid to say. There are still all the &lt;em&gt;other&lt;/em&gt;&amp;nbsp;hurdles that you have to go through to actually &lt;em&gt;mature&lt;/em&gt;&amp;nbsp;a project to be able to go all the way to production and evolve over time without exploding costs &amp;amp; complexities.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203907-b/the-million-ai-monkeys-hypothesis-real-world-projects?Key=76196b00-f0e4-4d7a-a587-4187133e99c0</link><guid>http://ayende.com/203907-b/the-million-ai-monkeys-hypothesis-real-world-projects?Key=76196b00-f0e4-4d7a-a587-4187133e99c0</guid><pubDate>Fri, 27 Feb 2026 12:00:00 GMT</pubDate></item><item><title>AI &amp; the movie Eagle Eye</title><description>&lt;p&gt;miscellaneous, development&lt;/p&gt;&lt;p&gt;In 2008, the movie Eagle Eye came out. I remember watching that at the time and absolutely loving this movie. It is an action movie, so enjoying it once is the sole criteria that I have. Surprisingly, I got flashbacks of this movie repeatedly in the past few weeks.&lt;/p&gt;&lt;p&gt;&lt;img src="/blog/Images/iDVRZlLhy3kwVTSqtLZQkQ.png"/&gt;&lt;/p&gt;&lt;p&gt;I think it is safe to talk about &amp;ldquo;spoilers&amp;rdquo; for a movie that is old enough to drive, so the core idea in this movie is that an AI wants to perform a certain action, but is prevented from doing so. It then comes up with a pretty convoluted approach to bypassing those limits. I&amp;rsquo;m intentionally vague here, because the movie is actually good and you should watch it.&lt;/p&gt;&lt;p&gt;The key here, which is the reason that I remember an 18 years old movie, is that we are actually seeing this behavior today with AI agents. It is an entirely&amp;nbsp;relatable phenomenon&amp;nbsp;to see the agent running into an obstacle, and then trying to bypass it using crazier and crazier techniques.&lt;/p&gt;&lt;p&gt;The movie aged particularly well in this regard, because what was a plot device in there is a daily occurrence in our lives now. For reference, &lt;a href="https://x.com/summeryue0/status/2025774069124399363"&gt;see this Tweet&lt;/a&gt;.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203875-a/ai-the-movie-eagle-eye?Key=84506b1e-56e9-4c6e-9340-9228f2780ae9</link><guid>http://ayende.com/203875-a/ai-the-movie-eagle-eye?Key=84506b1e-56e9-4c6e-9340-9228f2780ae9</guid><pubDate>Wed, 25 Feb 2026 12:00:00 GMT</pubDate></item><item><title>The hole in my falloaction</title><description>&lt;p&gt;I am working a bit with sparse files, and I need to output the list of holes in my file. &lt;/p&gt;&lt;p&gt;To my great surprise, I found that my file had more holes than I put into it. This probably deserves a bit of explanation. &lt;/p&gt;&lt;p&gt;If you know what sparse files are, feel free to skip this explanation:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;A sparse filereduces disk space usage by storing only the &lt;em&gt;non-zero&lt;/em&gt;&amp;nbsp;data blocks.Zero-filled regions (&amp;quot;holes&amp;quot;) are recorded as file system metadata&amp;nbsp;only. &lt;/p&gt;&lt;p&gt;The file still has the same &amp;ldquo;size&amp;rdquo;, but we don&amp;rsquo;t &lt;em&gt;need&lt;/em&gt;&amp;nbsp;to dedicate actual disk space for ranges that are filled with zeros, we can just remember that there are zeros there. This is a natural consequence of the fact that files aren&amp;rsquo;t actually composed of linear space on disk.&lt;/p&gt;&lt;p&gt;Filesystems grow files using extents (contiguous disk chunks).A file initially gets a single&amp;nbsp;extent (e.g., 1MB).Fast I/O is maintained as sequential data fills this contiguous block.Once&amp;nbsp;the extent is full, the filesystem allocates a new, separate extent (which will &lt;em&gt;not&lt;/em&gt;&amp;nbsp;reside next to the previous one, most likely).The file&amp;#39;s &lt;em&gt;logical&lt;/em&gt;&amp;nbsp;size grows continuously, but physical allocation occurs in discrete bursts as new extents are dynamically added.&lt;/p&gt;&lt;p&gt;If you are old enough to remember running defrag, that was essentially what it did. Ensured that the whole file was a single continuous allocation on disk. Because of this, it is very simple for a file system to just record holes, and the only file system that you&amp;rsquo;ll find in common use today that doesn&amp;rsquo;t support it is FAT.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;At any rate, I had a problem. My file has more holes than expected, and that is &lt;em&gt;not&lt;/em&gt;&amp;nbsp;a good thing. This is the sort of thing that calls for a &amp;ldquo;Stop, investigate, blog&amp;rdquo; reaction. Hence, this post.&lt;/p&gt;&lt;p&gt;Let&amp;rsquo;s see a small example that demonstrates this:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-bash'&gt;&lt;code class='line-numbers language-bash'&gt;&lt;span class="token comment"&gt;#define _GNU_SOURCE&lt;/span&gt;
&lt;span class="token comment"&gt;#include &amp;lt;stdio.h&gt;&lt;/span&gt;
&lt;span class="token comment"&gt;#include &amp;lt;fcntl.h&gt;&lt;/span&gt;
&lt;span class="token comment"&gt;#include &amp;lt;unistd.h&gt;&lt;/span&gt;


int &lt;span class="token function-name function"&gt;main&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
&lt;span class="token punctuation"&gt;{&lt;/span&gt;
    const off_t file_size &lt;span class="token operator"&gt;=&lt;/span&gt; 1024LL * &lt;span class="token number"&gt;1024&lt;/span&gt; * &lt;span class="token number"&gt;1024&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    int fd &lt;span class="token operator"&gt;=&lt;/span&gt; open&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;"test-sparse-file.dat"&lt;/span&gt;, O_CREAT &lt;span class="token operator"&gt;|&lt;/span&gt; O_RDWR &lt;span class="token operator"&gt;|&lt;/span&gt; O_TRUNC, 0644&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    fallocate&lt;span class="token punctuation"&gt;(&lt;/span&gt;fd, &lt;span class="token number"&gt;0&lt;/span&gt;, &lt;span class="token number"&gt;0&lt;/span&gt;, file_size&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    
    off_t offset &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    &lt;span class="token keyword"&gt;while&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;offset &lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt; file_size&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token punctuation"&gt;{&lt;/span&gt;
        off_t hole_start &lt;span class="token operator"&gt;=&lt;/span&gt; lseek&lt;span class="token punctuation"&gt;(&lt;/span&gt;fd, offset, SEEK_HOLE&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        &lt;span class="token keyword"&gt;if&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;hole_start &lt;span class="token operator"&gt;&gt;=&lt;/span&gt; file_size&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token builtin class-name"&gt;break&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        
        off_t hole_end &lt;span class="token operator"&gt;=&lt;/span&gt; lseek&lt;span class="token punctuation"&gt;(&lt;/span&gt;fd, hole_start, SEEK_DATA&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        &lt;span class="token keyword"&gt;if&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;hole_end &lt;span class="token operator"&gt;&amp;lt;&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; hole_end &lt;span class="token operator"&gt;=&lt;/span&gt; file_size&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        
        printf&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;"Start: %.2f MB, End: %.2f MB&lt;span class="token entity" title="\n"&gt;\n&lt;/span&gt;"&lt;/span&gt;, 
               hole_start / &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token number"&gt;1024.0&lt;/span&gt; * &lt;span class="token number"&gt;1024.0&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;,
               hole_end / &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token number"&gt;1024.0&lt;/span&gt; * &lt;span class="token number"&gt;1024.0&lt;/span&gt;&lt;span class="token punctuation"&gt;))&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
        
        offset &lt;span class="token operator"&gt;=&lt;/span&gt; hole_end&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    &lt;span class="token punctuation"&gt;}&lt;/span&gt;
    
    close&lt;span class="token punctuation"&gt;(&lt;/span&gt;fd&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
    &lt;span class="token builtin class-name"&gt;return&lt;/span&gt; &lt;span class="token number"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
&lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;If you run this code, you&amp;rsquo;ll see this surprising result:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-yaml'&gt;&lt;code class='line-numbers language-yaml'&gt;&lt;span class="token key atrule"&gt;Start&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; 0.00 MB&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token key atrule"&gt;End&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; 1024.00 MB&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;In other words, even though we just use &lt;code&gt;fallocate()&lt;/code&gt;&amp;nbsp;to &lt;em&gt;ensure&lt;/em&gt;&amp;nbsp;that we reserved the disk space, as far as &lt;code&gt;lseek()&lt;/code&gt;&amp;nbsp;is concerned, it is just one big hole. What is going on here?&lt;/p&gt;&lt;p&gt;Let&amp;rsquo;s dig a little deeper, using filefrag:&lt;/p&gt;&lt;p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-yaml'&gt;&lt;code class='line-numbers language-yaml'&gt;$ filefrag &lt;span class="token punctuation"&gt;-&lt;/span&gt;b1048576 &lt;span class="token punctuation"&gt;-&lt;/span&gt;v test&lt;span class="token punctuation"&gt;-&lt;/span&gt;sparse&lt;span class="token punctuation"&gt;-&lt;/span&gt;file.dat 
&lt;span class="token key atrule"&gt;Filesystem type is&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; ef53
File size of test&lt;span class="token punctuation"&gt;-&lt;/span&gt;sparse&lt;span class="token punctuation"&gt;-&lt;/span&gt;file.dat is 1073741824 (1024 blocks of 1048576 bytes)
 &lt;span class="token key atrule"&gt;ext&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;logical_offset&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;        &lt;span class="token key atrule"&gt;physical_offset&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; &lt;span class="token key atrule"&gt;length&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;   &lt;span class="token key atrule"&gt;expected&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; &lt;span class="token key atrule"&gt;flags&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;
   &lt;span class="token key atrule"&gt;0&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;        &lt;span class="token key atrule"&gt;0..      23&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165608..    165631&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;24&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;             unwritten
   &lt;span class="token key atrule"&gt;1&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;       &lt;span class="token key atrule"&gt;24..     151&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165376..    165503&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165632&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;2&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;152..     279&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165248..    165375&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165504&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;3&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;280..     407&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165120..    165247&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165376&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;4&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;408..     535&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164992..    165119&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165248&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;5&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;536..     663&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164864..    164991&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;165120&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;6&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;664..     791&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164736..    164863&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164992&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;7&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;792..     919&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164608..    164735&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;128&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164864&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; unwritten
   &lt;span class="token key atrule"&gt;8&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;      &lt;span class="token key atrule"&gt;920..    1023&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164480..    164583&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;    &lt;span class="token key atrule"&gt;104&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt;     &lt;span class="token key atrule"&gt;164736&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; last&lt;span class="token punctuation"&gt;,&lt;/span&gt;unwritten&lt;span class="token punctuation"&gt;,&lt;/span&gt;eof
&lt;span class="token key atrule"&gt;test-sparse-file.dat&lt;/span&gt;&lt;span class="token punctuation"&gt;:&lt;/span&gt; 9 extents found&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;/p&gt;&lt;p&gt;You can see that the file is made of 9 separate extents. The first one is 24MB in size, then 7 extents that are 128MB each, and the final one is 104MB.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;Amusingly enough, the physical layout of the file is in reverse order to the logical layout of the file. That is just the allocation pattern of the file system, since there is no relation between the two.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;Now, let&amp;rsquo;s try to figure out what is going on here. Do you see the flags on those extents? It says &lt;code&gt;unwritten&lt;/code&gt;. That means this is physical space that was allocated to the file, but the file system is aware that it never wrote to that space. Therefore, that space &lt;em&gt;must&lt;/em&gt;&amp;nbsp;be zero. &lt;/p&gt;&lt;p&gt;In other words, conceptually, this unwritten space is no different from a sparse region in the file. In both cases, the file system can just hand me a block of zeros when I try to access it.&lt;/p&gt;&lt;p&gt;The question is, why is the file system behaving in this manner? And the answer is that this is an optimization. Instead of reading the data (which we &lt;em&gt;know&lt;/em&gt;&amp;nbsp;to be zeros) from the disk, we can just hand it over to the application directly. That saves on I/O, which is quite nice.&lt;/p&gt;&lt;p&gt;Consider the typical scenario of allocating a file and then writing to it. Without this optimization, we would literally &lt;em&gt;double&lt;/em&gt;&amp;nbsp;the amount of I/O &amp;nbsp;we have to do. &lt;/p&gt;&lt;p&gt;It turns out that this optimization also applies to Windows and Mac, but the reason I ran into that on Linux is that I used the &lt;code&gt;lseek(SEEK_HOLE)&lt;/code&gt;, which considers the unwritten portion as a sparse hole as well. This makes sense, since if I want to copy data and I am aware of sparse regions, I &lt;em&gt;should&lt;/em&gt;&amp;nbsp;treat the unwritten portions as holes as well. &lt;/p&gt;&lt;p&gt;You can use the &lt;code&gt;ioctl(FS_IOC_FIEMAP)&lt;/code&gt;&amp;nbsp;to inspect the actual file extents (this is what &lt;code&gt;filefrag&lt;/code&gt;&amp;nbsp;does) if you actually care about the difference.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203843-c/the-hole-in-my-falloaction?Key=792324ea-5ab1-498a-b596-3082054f0601</link><guid>http://ayende.com/203843-c/the-hole-in-my-falloaction?Key=792324ea-5ab1-498a-b596-3082054f0601</guid><pubDate>Thu, 05 Feb 2026 12:00:00 GMT</pubDate></item><item><title>A tale of one-off, coding agents and the shortest path to victory</title><description>&lt;p&gt;I needed to export all the messages from one of our Slack channels. Slack has a way of exporting &lt;em&gt;everything&lt;/em&gt;, but nothing that could easily just give me all the messages in a single channel.&lt;/p&gt;&lt;p&gt;There are tools like slackdump or Slack apps that I could use, and I tried, but I got lost trying to make it work. In frustration, I opened VS Code and wrote:&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;I want a simple node.js that accepts a channel name from Slack and export all the messages in the channel to a CSV file&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The output was a single script and instructions on how I should register to get the right token. It literally took me less time to ask for the script than to try to figure out how to use the &amp;ldquo;proper&amp;rdquo; tools for this.&lt;/p&gt;&lt;p&gt;The ability to do these sorts of one-off things is &lt;strong&gt;exhilarating&lt;/strong&gt;. &lt;/p&gt;&lt;p&gt;Keep in mind: this isn&amp;rsquo;t generally applicable if you need something that would actually work over time. See &lt;a href="https://ayende.com/blog/203779-A/maintainability-in-the-age-of-coding-agents?key=2301e977ca474a28969f5bdad6dcad9f"&gt;my other post&lt;/a&gt;&amp;nbsp;for details on that.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203811-a/a-tale-of-one-off-coding-agents-and-the-shortest-path-to-victory?Key=7d74c708-dfba-44a4-9fea-d70a6e35c936</link><guid>http://ayende.com/203811-a/a-tale-of-one-off-coding-agents-and-the-shortest-path-to-victory?Key=7d74c708-dfba-44a4-9fea-d70a6e35c936</guid><pubDate>Mon, 02 Feb 2026 12:00:00 GMT</pubDate></item><item><title>Maintainability in the age of coding agents</title><description>&lt;p&gt;Modern coding agents can generate a &lt;em&gt;lot&lt;/em&gt;&amp;nbsp;of code very quickly.What once consumed days or weeks of a person&amp;rsquo;s time is now a simple matter of a prompt and a coffee break.The question is whether this changes any of the fundamental principles ofsoftware development.&lt;/p&gt;
&lt;p&gt;A significant portion of software engineering&amp;nbsp;(beyond pure algorithms and data structure work) is not about the code itself, but about managing the social aspects of&amp;nbsp;building and evolving&amp;nbsp;the software&amp;nbsp;over time.&lt;/p&gt;
&lt;p&gt;Our system's architecture inherently mirrors the structure of the organization that builds it, as stated by Conway's Law.Therefore, software engineering deals a lot with how a software project&amp;nbsp;is structured to ensure that&amp;nbsp;a (human) team can deliver, make changes, and maintain it over time.&lt;/p&gt;
&lt;p&gt;That is&amp;nbsp;why maintainability is such a high-value target:&amp;nbsp;an unmaintainable project quickly becomes one no one can safely change.&amp;nbsp;A good example is OpenSSL circa Heartbleed, or your bank&amp;rsquo;s COBOL-based core systems.&lt;/p&gt;
&lt;p&gt;Does this still apply&amp;nbsp;in the&amp;nbsp;era of coding agents?If a new feature is needed, and I can simply ask a model to regenerate the whole thing from scratch, bypassing technical debt and re-incorporating all constraints, do I still need to worry about maintainability?&lt;/p&gt;
&lt;p&gt;My answer in this regard is emphatically &lt;em&gt;yes&lt;/em&gt;.There is &lt;em&gt;immense&lt;/em&gt;&amp;nbsp;value in ensuring the maintainability of projects, even in the age of AI agents.&lt;/p&gt;
&lt;p&gt;One of the most obvious answers is that a maintainable project minimizes the amount of code you must review and touch to make a change.Translating this into the language of Large Language Models, this means you are fundamentally reducing the required context needed to execute a change.&lt;/p&gt;
&lt;p&gt;It isn&amp;rsquo;t just about saving our token&amp;nbsp;budget. Even assuming an&amp;nbsp;essentially unlimited budget, the true value extends beyond mere computation cost.&lt;/p&gt;
&lt;p&gt;The maintainability of a software project remains critical because you cannot &lt;em&gt;trust&lt;/em&gt;&amp;nbsp;a model to act with absolute competence.You do not have the option of simply telling a model, "Make this application secure," and blindly expecting a perfect outcome. It will give you a thumbs-up&amp;nbsp;and place your product API key in the client-side code.&lt;/p&gt;
&lt;p&gt;Furthermore, in a mature software project, even one built entirely with AI, making substantial changes using an AI agent is incredibly risky.Consider the scenario where you spend a week with an agent, carefully tweaking the system's behavior, reviewing the code, and directing its output into the exact shape required.&lt;/p&gt;
&lt;p&gt;Six months later, you return to the same area for a change.If the model rewrites everything from scratch,&amp;nbsp;because it can, the entire context and history of those days and weeks of careful guidancewill be&amp;nbsp;lost.This lost context is far more valuable than the code itself.&lt;/p&gt;
&lt;p&gt;Remember Hyrum&amp;rsquo;s Law: "With a sufficient number of users of an API, it does not matter what you promise in the contract:all observable behaviors of your system will be depended on by somebody."&lt;/p&gt;
&lt;p&gt;The "sufficient number of users" is surprisingly low, and observable behaviors include non-obvious factors like performance characteristics, the order of elements in a JSON document, the packet merging algorithm in a router you weren&amp;rsquo;t even aware existed, etc.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The key is this: if&amp;nbsp;a coding agent routinely rewrites large swaths of code, you are not performing an equivalent exchange.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Even if the old code had&amp;nbsp;been AI-generated, it was&amp;nbsp;subsequently subjected to human review, clarification, testing, and verification&amp;nbsp;by users, then deployed - and it survived the production environment and production loads.&lt;/p&gt;
&lt;p&gt;The entirely new code has no validated quality yet.You must still expend time and effort&amp;nbsp;to verify its correctness.&lt;em&gt;That&lt;/em&gt;&amp;nbsp;is the difference between the existing code and the new one.&lt;/p&gt;
&lt;p&gt;Over 25 years ago, &lt;a href="https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/"&gt;Joel Spolsky wrote Things You Should Never Do&lt;/a&gt;&amp;nbsp;about the Netscape rewrite. That particular article has &lt;em&gt;withstood &lt;/em&gt;the test of time very well. And it is entirely relevant in the age of coding agents as well.&lt;/p&gt;
&lt;p&gt;Part of my job involves reviewing code on a project that is&amp;nbsp;over fifteen years old with over a million lines of code. The past week,I've reviewed pull requests ranging from changes of a few hundred lines&amp;nbsp;to one that changed over 10,000&amp;nbsp;lines of code.&lt;/p&gt;
&lt;p&gt;The complexity involved in code review scales exponentially with the amount of code changed, because you must understand not just the changed code,&amp;nbsp;but all its interactions with the rest of the system.&lt;/p&gt;
&lt;p&gt;That 10,000+ lines of code pull request is something that is applicable for &lt;em&gt;major&lt;/em&gt;&amp;nbsp;features, worth the time and effort that it takes to properly understand and evaluate the change.&lt;/p&gt;
&lt;p&gt;Thinking that you can just have a coding agent throw big changes on a project fundamentally misunderstands how projects thrive. And assuming you can have one agent write the code and another review it is a short trip to madness.&lt;/p&gt;
&lt;p&gt;In summary, maintainability in the age of coding agents looks remarkably like it did before.The essential requirements remain: clear boundaries, a consistent architecture, and the ability to go into a piece of code and understand exactly what it's doing.&lt;/p&gt;
&lt;p&gt;Funnily enough, the same aspects of good software engineering discipline also translate well into best practices for AI usage: limiting the scope of change, reducing the amount of required context, etc.&lt;/p&gt;
&lt;p&gt;You should aim to modify a single piece of code, or better yet, create new code instead of modifying existing,&amp;nbsp;validated code&amp;nbsp;(Open/Closed Principle).&lt;/p&gt;
&lt;p&gt;Even with AI, the human act of reviewing code is still crucial.And if your proposed solution is to have one AI agent review another, you have simply pushed the problem one layer up, as you are still faced with the necessity of specifying exactly what the system is supposed to be doing in a way that is unambiguous and clear.&lt;/p&gt;
&lt;p&gt;There is already a proper way to do that, we call it coding 🙂.&lt;/p&gt;
</description><link>http://ayende.com/203779-a/maintainability-in-the-age-of-coding-agents?Key=2301e977-ca47-4a28-969f-5bdad6dcad9f</link><guid>http://ayende.com/203779-a/maintainability-in-the-age-of-coding-agents?Key=2301e977-ca47-4a28-969f-5bdad6dcad9f</guid><pubDate>Fri, 30 Jan 2026 12:00:00 GMT</pubDate></item><item><title>API Design: Don't try to guess</title><description>&lt;p&gt;I was reviewing some code, and I ran into the following snippet. Take a look at it:&lt;/p&gt;&lt;hr/&gt;&lt;pre class='line-numbers language-java'&gt;&lt;code class='line-numbers language-java'&gt;&lt;span class="token keyword"&gt;public&lt;/span&gt; &lt;span class="token keyword"&gt;void&lt;/span&gt; &lt;span class="token class-name"&gt;AddAttachment&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;string fileName&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token class-name"&gt;Stream&lt;/span&gt; stream&lt;span class="token punctuation"&gt;)&lt;/span&gt;
   &lt;span class="token punctuation"&gt;{&lt;/span&gt;
       &lt;span class="token class-name"&gt;ValidationMethods&lt;span class="token punctuation"&gt;.&lt;/span&gt;AssertNotNullOrEmpty&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;fileName&lt;span class="token punctuation"&gt;,&lt;/span&gt; &lt;span class="token function"&gt;nameof&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;fileName&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
       &lt;span class="token keyword"&gt;if&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;stream &lt;span class="token operator"&gt;==&lt;/span&gt; &lt;span class="token keyword"&gt;null&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
           &lt;span class="token keyword"&gt;throw&lt;/span&gt; &lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;ArgumentNullException&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token function"&gt;nameof&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;stream&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;


       string type &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;GetContentType&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;fileName&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;


       _attachments&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;span class="token function"&gt;Add&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token keyword"&gt;new&lt;/span&gt; &lt;span class="token class-name"&gt;PutAttachmentCommandData&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token string"&gt;"__this__"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt; fileName&lt;span class="token punctuation"&gt;,&lt;/span&gt; stream&lt;span class="token punctuation"&gt;,&lt;/span&gt; type&lt;span class="token punctuation"&gt;,&lt;/span&gt; changeVector&lt;span class="token operator"&gt;:&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;string&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;Empty&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
   &lt;span class="token punctuation"&gt;}&lt;/span&gt;


   &lt;span class="token keyword"&gt;private&lt;/span&gt; &lt;span class="token keyword"&gt;static&lt;/span&gt; string &lt;span class="token class-name"&gt;GetContentType&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;string fileName&lt;span class="token punctuation"&gt;)&lt;/span&gt;
   &lt;span class="token punctuation"&gt;{&lt;/span&gt;
       &lt;span class="token keyword"&gt;var&lt;/span&gt; extension &lt;span class="token operator"&gt;=&lt;/span&gt; &lt;span class="token class-name"&gt;Path&lt;span class="token punctuation"&gt;.&lt;/span&gt;GetExtension&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;fileName&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
       &lt;span class="token keyword"&gt;if&lt;/span&gt; &lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;string&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;IsNullOrEmpty&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;extension&lt;span class="token punctuation"&gt;)&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt;
           &lt;span class="token keyword"&gt;return&lt;/span&gt; &lt;span class="token string"&gt;"image/jpeg"&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt; &lt;span class="token comment"&gt;// Default fallback&lt;/span&gt;


       &lt;span class="token keyword"&gt;return&lt;/span&gt; &lt;span class="token class-name"&gt;&lt;span class="token namespace"&gt;extension&lt;span class="token punctuation"&gt;.&lt;/span&gt;&lt;/span&gt;ToLowerInvariant&lt;/span&gt;&lt;span class="token punctuation"&gt;(&lt;/span&gt;&lt;span class="token punctuation"&gt;)&lt;/span&gt; &lt;span class="token keyword"&gt;switch&lt;/span&gt;
       &lt;span class="token punctuation"&gt;{&lt;/span&gt;
           &lt;span class="token string"&gt;".jpg"&lt;/span&gt; or &lt;span class="token string"&gt;".jpeg"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"image/jpeg"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           &lt;span class="token string"&gt;".png"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"image/png"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           &lt;span class="token string"&gt;".webp"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"image/webp"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           &lt;span class="token string"&gt;".gif"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"image/gif"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           &lt;span class="token string"&gt;".pdf"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"application/pdf"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           &lt;span class="token string"&gt;".txt"&lt;/span&gt; &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"text/plain"&lt;/span&gt;&lt;span class="token punctuation"&gt;,&lt;/span&gt;
           _ &lt;span class="token operator"&gt;=&lt;/span&gt;&lt;span class="token operator"&gt;&gt;&lt;/span&gt; &lt;span class="token string"&gt;"application/octet-stream"&lt;/span&gt;
       &lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;span class="token punctuation"&gt;;&lt;/span&gt;
   &lt;span class="token punctuation"&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;hr/&gt;&lt;p&gt;I don&amp;rsquo;t like this code because the API is trying to guess the intent of the caller. We are making some reasonable inferences here, for sure, but we are also ensuring that any future progress will require us to change our code, instead of letting the caller do that.&lt;/p&gt;&lt;p&gt;In fact, the caller probably knows a &lt;em&gt;lot&lt;/em&gt;&amp;nbsp;more than we do about what is going on. They know if they are uploading an image, and probably in what format too. They know that they just uploaded a CSV file (and that we need to classify it as plain text, etc.).&lt;/p&gt;&lt;p&gt;This is one of those cases where the best option is &lt;em&gt;not&lt;/em&gt;&amp;nbsp;to try to be smart. I recommended that we write the function to let the caller deal with it.&lt;/p&gt;&lt;p&gt;It is important to note that this is meant to be a public API in a library that is shipped to external customers, so changing something in the library is not easy (change, release, deploy, update - that can take a &lt;em&gt;while&lt;/em&gt;). We need to make sure that we aren&amp;rsquo;t &lt;em&gt;blocking&lt;/em&gt;&amp;nbsp;the caller from doing things they may want to. &lt;/p&gt;&lt;p&gt;This is a case of trying to help the user, but instead ending up crippling what they can do with the API.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203747-a/api-design-dont-try-to-guess?Key=683e3e2e-0a5f-4f10-a978-04e0f2fab851</link><guid>http://ayende.com/203747-a/api-design-dont-try-to-guess?Key=683e3e2e-0a5f-4f10-a978-04e0f2fab851</guid><pubDate>Thu, 29 Jan 2026 12:00:00 GMT</pubDate></item><item><title>Introducing: RavenDB Kubernetes Operator</title><description>&lt;p&gt;RavenDB has recently introduced its dedicated Kubernetes Operator, a big improvement over the Helm charts that teams have been using. This is meant to streamline database orchestration and management, essentially giving you an automated &amp;quot;SRE-in-a-box.&amp;quot;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;You can read the &lt;a href="https://github.com/ravendb/ravendb/discussions/22115"&gt;full announcement here&lt;/a&gt;. And the actual operator &lt;a href="https://github.com/ravendb/ravendb-operator?tab=readme-ov-file#ravendb-kubernetes-operator"&gt;is available here&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;The Operator shifts the management paradigm from manual configuration to a declarative model. Simply applying a &lt;code&gt;RavenDBCluster &lt;/code&gt;custom resource definition (CRD) allows developers to automate the heavy lifting of cluster formation, storage binding, and external networking, removing the operational friction typically associated with running stateful distributed systems on K8s.&lt;/p&gt;&lt;p&gt;Most importantly, it isn&amp;rsquo;t a one-time thing. The RavenDB Kubernetes Operator is all about &amp;quot;Day 2&amp;quot; operational intelligence. It handles complex lifecycle tasks with high precision, such as executing safe rolling upgrades with built-in validation gates to prevent breaking changes.&lt;/p&gt;&lt;p&gt;From dealing with the intricacies of certificate rotation&amp;mdash;supporting both Let&amp;rsquo;s Encrypt and private PKI&amp;mdash;to providing real-time health insights directly via &lt;code&gt;kubectl&lt;/code&gt;, the automation of these critical maintenance tasks lets the Operator ensure that your RavenDB clusters remain resilient, secure, and performant with minimal manual intervention.&lt;/p&gt;&lt;p&gt;For example, you can push an upgrade from RavenDB 7.0 to RavenDB 7.2, and the Operator will automatically handle performing a rolling upgrade for you, ensuring there is no downtime during deployment. There is no need for complex orchestration playbooks, you just push the update, and it happens for you.&lt;/p&gt;&lt;p&gt;This is part of the same DevOps push we are making. &lt;a href="https://ravendb.net/articles/ravendb-ansible-collection-new-features-12-25?utm_source=linkedin&amp;utm_medium=organic&amp;utm_campaign=New_Features"&gt;If you are partial to Ansible, on the other hand, we have recently published great support there as well&lt;/a&gt;.&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203715-a/introducing-ravendb-kubernetes-operator?Key=cca815c3-a486-4117-a0dd-0a9047b6095d</link><guid>http://ayende.com/203715-a/introducing-ravendb-kubernetes-operator?Key=cca815c3-a486-4117-a0dd-0a9047b6095d</guid><pubDate>Thu, 15 Jan 2026 12:00:00 GMT</pubDate></item><item><title>Hiring: Sales Engineer in Europe</title><description>&lt;p&gt;I&amp;rsquo;m looking for a key technical voice to join the team: a Sales Engineer who will be based in a GMT to GMT+3 time zone&amp;nbsp;to best support our growing European and international customer base.&lt;/p&gt;&lt;p&gt;We want someone who is passionate about solving complex technical challenges who can have fun talking to people and building relationships.You&amp;rsquo;ll bridge the gap between our technology and our customers&amp;#39; business needs.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;The Technical Chops:&lt;/strong&gt;We need a technical champion for the sales process.That means diving deep into solution architecture, designing and executing proof-of-concepts, and helping customers architect reliable, scalable, and ridiculously fast systems using RavenDB.You need to understand databases (SQL, NoSQL, and the cloud), and be ready to learn RavenDB&amp;#39;s powerful features inside and out.If you have a background in development (C#, Java, Python&amp;mdash;it all helps!) and enjoy thinking about things like indexing strategies, data modeling, and performance tuning, you&amp;rsquo;ll love this.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;People Person:&lt;/strong&gt;&amp;nbsp;You need to be able to walk into a room (virtual or physical), quickly identify a customer&amp;#39;s pain points, and articulate a clear, compelling vision for how RavenDB solves them.This role requires excellent communication skills&amp;mdash;you&amp;rsquo;ll be giving engaging demos, leading technical presentations, and collaborating directly with high-level technical teams.If you can discuss a multi-region deployment strategy one minute and explain the ROI to a business executive the next, you&amp;rsquo;ve got the commercial savviness we&amp;rsquo;re looking for.&lt;/p&gt;&lt;p&gt;You should have 3+ years of experience in a pre-sales or solution architecture role.&amp;nbsp;A strong general database background is required, experience with NoSQL databases is a big plus.&lt;/p&gt;&lt;p&gt;Please ping us either via commenting here or submit your details to &lt;a href="mailto:jobs@ravendb.net"&gt;jobs@ravendb.net&lt;/a&gt;&lt;/p&gt;
&lt;link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/9000.0.1/themes/prism.min.css" integrity="sha512-/mZ1FHPkg6EKcxo0fKXF51ak6Cr2ocgDi5ytaTBjsQZIH/RNs6GF6+oId/vPe3eJB836T36nXwVh/WBl/cWT4w==" crossorigin="anonymous" referrerpolicy="no-referrer" /&gt;</description><link>http://ayende.com/203683-c/hiring-sales-engineer-in-europe?Key=80d2204e-d285-4212-97bc-14a208b50f41</link><guid>http://ayende.com/203683-c/hiring-sales-engineer-in-europe?Key=80d2204e-d285-4212-97bc-14a208b50f41</guid><pubDate>Tue, 13 Jan 2026 12:00:00 GMT</pubDate></item></channel></rss>