<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anish Shrestha</title>
    <description>The latest articles on DEV Community by Anish Shrestha (@anyesh).</description>
    <link>https://dev.to/anyesh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F202575%2F3ff44b38-0271-4c86-9438-14b0ada88277.png</url>
      <title>DEV Community: Anish Shrestha</title>
      <link>https://dev.to/anyesh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anyesh"/>
    <language>en</language>
    <item>
      <title>incr: incremental computation, measured in a live service</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Tue, 17 Nov 2026 16:11:17 +0000</pubDate>
      <link>https://dev.to/anyesh/incr-incremental-computation-measured-in-a-live-service-361k</link>
      <guid>https://dev.to/anyesh/incr-incremental-computation-measured-in-a-live-service-361k</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;a href="https://github.com/Anyesh/incr" rel="noopener noreferrer"&gt;incr&lt;/a&gt; is a Rust library with Python bindings that records which computations read which values and, when a value changes, reruns only what that change affects. It runs as the engine of a private product's live forecasting service. There, a hot standby takes over in 2.09 s against 434 s for a cold standby (208x; it ships off by default, and a standby holds about as much memory as the leader). Nightly delta checkpoints take 0.7 to 1.0 s against 44.4 s and 48.1 s full writes in the same run (44x to 69x; the store checkpoint and compaction did not get shorter). A recompute of the same figures without incr found zero wrong out of 2,748,751. This post covers how it works, what it measured in that service, and what it still costs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What incr is
&lt;/h2&gt;

&lt;p&gt;incr has two ways in. Function graphs wire computations that depend on each other:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;incr_compute&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;10.0_f&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_input&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;5.0_f&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;area&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_query&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;move&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;area&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;          &lt;span class="c1"&gt;// 50.0&lt;/span&gt;
&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;12.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;area&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;          &lt;span class="c1"&gt;// 60.0, and only area reran&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Incremental collections are a pipeline of operators where inserting or deleting a row flows only that row through. Here a stream of readings is kept in time order, each reading is paired with the next, and the largest step between neighbours is maintained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;incr_compute&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;IncrCollection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;IncrCollection&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Reading&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create_collection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;ordered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort_by_key&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ordered&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pairwise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;aggregate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;first&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;third&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Move one reading: only the pairs on either side of it recompute.&lt;/span&gt;
&lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;readings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;insert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;second_corrected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;largest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ten operators ship (&lt;code&gt;filter&lt;/code&gt;, &lt;code&gt;map&lt;/code&gt;, &lt;code&gt;count&lt;/code&gt;, &lt;code&gt;aggregate&lt;/code&gt;, &lt;code&gt;reduce&lt;/code&gt;, &lt;code&gt;sort_by_key&lt;/code&gt;, &lt;code&gt;pairwise&lt;/code&gt;, &lt;code&gt;window&lt;/code&gt;, &lt;code&gt;group_by&lt;/code&gt;, &lt;code&gt;join&lt;/code&gt;), and all of them do work proportional to the change. &lt;code&gt;aggregate&lt;/code&gt; keeps a balanced tree of partial folds, so it costs O(log n) per row even for a fold like &lt;code&gt;max&lt;/code&gt; that has no inverse. The Rust crates are &lt;code&gt;incr-compute&lt;/code&gt; (single-threaded), &lt;code&gt;incr-concurrent&lt;/code&gt; (&lt;code&gt;Send + Sync&lt;/code&gt;), &lt;code&gt;incr-core&lt;/code&gt; (the engine), &lt;code&gt;incr-persist&lt;/code&gt; and &lt;code&gt;incr-kube&lt;/code&gt;; the Python wheels are &lt;code&gt;incr-compute&lt;/code&gt; and &lt;code&gt;incr-concurrent&lt;/code&gt; (&lt;code&gt;pip install --pre&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Both surface crates are the same engine, parameterized by a &lt;code&gt;Cells&lt;/code&gt; trait. The Local flavour uses &lt;code&gt;Cell&lt;/code&gt; and &lt;code&gt;RefCell&lt;/code&gt;, with no atomics; the Shared flavour uses atomics. Both monomorphize the same source, so a single-threaded user has no fence cost. Shared exists so that readers are not blocked by writers, where Salsa takes &lt;code&gt;&amp;amp;mut db&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it stays proportional to the change
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;rt.set&lt;/code&gt; does almost nothing: it flips a dirty flag on every node downstream. The work happens in &lt;code&gt;rt.get&lt;/code&gt;, which walks back from the node you asked for, checks whether each dirty node's dependencies really changed, and reruns only those. Dependencies are recorded by identity as a compute reads nodes, so nobody declares them. When a recomputed value comes out equal to the old one, the wave stops there; that is early cutoff.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Setting &lt;code&gt;b&lt;/code&gt; only flips flags. Reading reruns &lt;code&gt;q2&lt;/code&gt; and &lt;code&gt;q3&lt;/code&gt;; &lt;code&gt;q2&lt;/code&gt; comes out equal, so &lt;code&gt;r1&lt;/code&gt; is verified without running, and only &lt;code&gt;r2&lt;/code&gt; reruns.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A dependency graph with inputs a and b, queries q1 reading a, q2 and q3 reading b, and outputs r1 reading q1 and q2, and r2 reading q3. Setting b marks q2, q3, r1 and r2 dirty. Reading the outputs reruns q2 and q3. q2 comes out equal to its old value, so early cutoff stops there and r1 is verified without rerunning. q3 changed, so r2 reruns. a and q1 are never touched.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Collections work the same way one level down. Each stage keeps a read offset into its upstream stage's change log, so one insert into a 100K-row collection costs O(1) per stage instead of a rescan. User closures never run under an engine lock, and a closure that panics (or raises, from Python) applies nothing; the batch replays.&lt;/p&gt;

&lt;p&gt;The README's insert-then-read benchmark compares that against recomputing the same filter, map and count pipeline from scratch:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Insert one row, then read, against recomputing from scratch (the README table). The incr cost stays flat as the collection grows.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Log-scale bars of insert-then-read cost. At 1K rows: incr 557 nanoseconds against 101 microseconds from scratch, about 180x. At 10K: 632 nanoseconds against 66 microseconds, about 105x. At 100K: 662 nanoseconds against 146 microseconds, about 220x.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A separate micro-benchmark on incr's bench machine shows the same flatness across flavours: insert-then-read costs about 520 to 570 ns on Local and 1.13 to 1.20 µs on Shared, flat from 1K to 100K rows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persistence, restore, standby and what-if
&lt;/h2&gt;

&lt;p&gt;A graph that lives for days needs to survive a restart without rebuilding from source. incr persists a log plus snapshots through pluggable backends, with checkpoint triggers and a conformance suite that any custom backend can run. The memo goes further: computed entries are persisted together with their dependencies, so after a reopen an entry verifies without running for as long as its inputs are unchanged. A restart reloads the log and memo and recomputes only entries whose stored dependencies changed, and a standby follows the leader's log so it is already warm when it takes over.&lt;/p&gt;

&lt;p&gt;Two releases cut the cost of checkpoints inside incr. beta.10 added delta memo checkpoints: each checkpoint appends only the changed entries plus tombstones, and the chain is compacted into a full generation at 8 deltas or when the deltas grow past a quarter of the base. The memo lock is held for 31 to 42 ms at 600k entries. beta.11 streamed store compaction: the backend pulls the snapshot as a lazy iterator, so checkpoint peak memory stops scaling with the size of the store.&lt;/p&gt;

&lt;p&gt;incr's own checkpoint benchmark (600k entries of 1,000 bytes, 6,000 of them dirty) puts the delta against beta.9's full write on four storage setups:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Delta memo checkpoint against beta.9's full write, from the CHANGELOG. Compare within a pair, never across pairs. These are delta-only; averaged over a cycle that includes compaction, the gain is 7.3x to 14x (see the table below).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Log-scale bars of checkpoint time, delta against beta.9 full write, with 600k entries of which 6,000 are dirty. NVMe file: 64 milliseconds against 3.5 seconds, 55x. NVMe SQLite: 115 milliseconds against 19.2 seconds, 167x. HDD file: 261 milliseconds against 9.5 seconds, 36x. HDD SQLite: 646 milliseconds against 58.2 seconds, 90x.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Streamed compaction shows up in the same benchmark as peak memory: at 600k rows, the peak RSS rise during compaction (peak RSS over RSS before it, not absolute bytes) fell from 84.5% to 1.33% with the file backend and from 121.7% to 2.37% with SQLite, which still holds its write transaction for the duration of the fold.&lt;/p&gt;

&lt;p&gt;The last piece is what-if. &lt;code&gt;rt.overlay()&lt;/code&gt; applies candidate changes on top of the live graph, lets you read the results, and on exit restores the base exactly: values, collections and keyed indexes. From Python:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;incr&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;KeyedCollection&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;

&lt;span class="n"&gt;rt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runtime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;items&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;KeyedCollection&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reconcile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"i1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"i2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;aggregate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;by_tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;collection&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;group_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;lambda&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upsert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"i3"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;by_tag&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_group&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"red"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overlay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;ov&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;upsert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"i4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"blue"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;ov&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;
&lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;rt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: An overlay applies a candidate change, reads through it, and on exit leaves the base exactly as it was.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Three stages of an overlay. Base: rows i1 red 8, i2 blue 6 and i3 red 4, total 18. Inside the overlay: a candidate row i4 blue 10 sits on a layer above the untouched base, and reading through the overlay gives 28. After exit: the layer is gone and the base reads 18 again, with values, collections and keyed indexes restored exactly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Overlays are Local only. They are not available on Shared until isolation there is proven.&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside a live service
&lt;/h2&gt;

&lt;p&gt;The service that runs incr is a private product's live forecasting service. It holds one in-memory graph per data set on the Local Python wheel, with one actor thread per data set. The large data set was about 2.6M input rows in 47 families at one early measurement, and about 929k nodes in the first prototype.&lt;/p&gt;

&lt;p&gt;Inputs are records that the owning services publish. Events carry only a change notice, and the service re-reads the record itself, so a duplicated or reordered event cannot change a result. Derived figures and dashboard counts are queries and collections over those inputs, and what-if reads (one candidate change evaluated across 300 alternatives) run in an overlay.&lt;/p&gt;

&lt;p&gt;The service only shows and forecasts. The system of record never waits on it, and a failure degrades its figures to stale or unavailable. Agreement is checked rather than assumed: input digests are stamped on records, and a drift check recomputes the figures without incr and compares them.&lt;/p&gt;

&lt;p&gt;For persistence, the log lives in a database, the memo is checkpointed nightly as a delta chain, and the store checkpoints and compacts periodically. A restart restores instead of rehydrating from source, and an optional hot standby follows the inputs without writing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hot standby takeover.&lt;/strong&gt; On the large data set, a hot standby went live 2.09 s after the leader was killed, against 434 s for a cold standby (208x). Cold hydration took 434 to 544 s across three starts on the same small 16 GB desktop machine. About 800k output rows over 10 tables were identical before the kill, after promotion, and against a later cold hydrate. The standby ships off by default, and it costs memory: it holds about as much as the leader (3.72 against 3.91 GiB), so 20 large-equivalent data sets would need about 150 GiB instead of about 78. A leader that freezes rather than dies adds a 10 s session timeout before promotion.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Kill to live on the large data set, same machine. The standby ships off by default and holds about as much memory as the leader.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Log-scale timeline from the leader being killed to the service being live. Hot standby: 2.09 seconds. Cold standby: 434 seconds, with cold hydration ranging from 434 to 544 seconds across three starts. 208x.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Nightly memo checkpoint.&lt;/strong&gt; In one 3 h 22 min run on a 24-core Linux box, with two controls EQUAL, delta nights took 0.7 to 1.0 s and wrote 2.4 to 2.7 MB each. The full writes in the same run took 44.4 s and 48.1 s, the compaction night writing 346.6 MB, which makes the deltas 44x to 69x faster. The store checkpoint (52 to 58 s) and the compaction memo step (about 46 to 48 s) did not get shorter. Separately, beta.11's delta night took 0.6 s for 3,887 entries, against 1.0 s for 3,827 on beta.10.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idle restart, kill to live.&lt;/strong&gt; On the same box and harness, restart went from 70 s on beta.10 to 54 s on beta.11 (1.3x, 23% faster), against a 60 s bar; the restore step inside it went from 58.0 to 43.3 s (1.34x), though the steady-memory control differed between the two runs (5.72 against 6.43 GiB). Earlier restarts on the same service took 120 s, then 78 to 81 s, then 57.4 s, and part of those gains is product code. The beta.10 to beta.11 step is, by my reading, incr's streamed compaction and lazy fingerprints.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory.&lt;/strong&gt; Checkpoint peaks fell between beta.10 and beta.11 while steady memory rose, which is why a single percentage would mislead:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Absolute peaks in the checkpoint run. Peaks fell by about 23% (6,906 to 5,334 MiB nightly, 6,966 to 5,385 MiB at compaction) while steady memory rose 726 MiB.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Dot plot of memory in MiB, beta.10 to beta.11. Nightly checkpoint peak: 6,906 down to 5,334. Compaction peak: 6,966 down to 5,385. Steady memory: 5,858 up to 6,584, because beta.11 retains rendered traces. The axis starts at 5,000 MiB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Correctness.&lt;/strong&gt; Compared against a recompute of the same figures without incr, the engine got 0 of 2,748,751 figures wrong (the run's record names a commit rather than a release), and 0 of 13,108 in a separate check.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before and after
&lt;/h2&gt;

&lt;p&gt;Every pair below is the same benchmark or harness on the same machine, before and after the change named in its row. Factors from any other kind of pair are left out.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
&lt;th&gt;Change&lt;/th&gt;
&lt;th&gt;Before → after&lt;/th&gt;
&lt;th&gt;Factor&lt;/th&gt;
&lt;th&gt;Caveat&lt;/th&gt;
&lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;&lt;td colspan="4"&gt;&lt;strong&gt;Released versions&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Memo checkpoint as delta generations, averaged over a cycle of 8 deltas and 1 compaction, against a full write every time (600k entries of 1,000 B, 6,000 dirty)&lt;/td&gt;
&lt;td&gt;NVMe file 3.5 s → 0.25 s; NVMe SQLite 19.2 → 1.8 s; HDD file 9.5 → 1.3 s; HDD SQLite 58.2 → 6.8 s&lt;/td&gt;
&lt;td&gt;14x, 11x, 7.3x, 8.6x&lt;/td&gt;
&lt;td&gt;Pairs run back to back against beta.9; the same disk varies 3 to 10x between windows. This is the average once compaction is counted. On HDD SQLite the compaction step alone is only about 1.05x faster than a full write (55.5 s against 58.2 s); the gain is that it happens once per 9 checkpoints.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Final memo checkpoint at the end of a 240,000-key end-to-end run, beta.9 → beta.10&lt;/td&gt;
&lt;td&gt;0.82 s → 0.02 s&lt;/td&gt;
&lt;td&gt;41x&lt;/td&gt;
&lt;td&gt;The automatic checkpoints before it are now deltas, so little is left to write; every other step in that run is within noise.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Store checkpoint streams records instead of materialising them, 600k keyed rows, beta.10 → beta.11&lt;/td&gt;
&lt;td&gt;file 1.37 s → 0.62 s; SQLite 1.71 → 1.10 s&lt;/td&gt;
&lt;td&gt;2.2x, 1.55x&lt;/td&gt;
&lt;td&gt;Same bench, release build, same NVMe box.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Same change, plain collection, peak memory rise during the checkpoint&lt;/td&gt;
&lt;td&gt;240.7% → 8.0% over resident size&lt;/td&gt;
&lt;td&gt;30x smaller rise&lt;/td&gt;
&lt;td&gt;The rise is peak RSS during the checkpoint over RSS before it, not absolute bytes. Plain collections store no rank, so they keep a small rise.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Shared runtime from Python: the GIL is taken once per 256 value calls instead of about 7 attaches per entry; memo first pass over 240,000 entries with automatic checkpointing&lt;/td&gt;
&lt;td&gt;10.3 s → 2.6 s; 20 batched write units during a checkpoint 22.6 → 2.3 s&lt;/td&gt;
&lt;td&gt;4.0x, 9.8x&lt;/td&gt;
&lt;td&gt;The same pass without checkpointing takes 1.8 s, so 2.6 s is within 1.4x of that floor. 12-core Linux box shared with other work.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;&lt;td colspan="4"&gt;&lt;strong&gt;Development, before release&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;O(N) count fixed in the filter, map and count pipeline, one insert at 1K, 10K and 100K rows&lt;/td&gt;
&lt;td&gt;42.7, 24.6, 30.8 µs → 673, 657, 661 ns&lt;/td&gt;
&lt;td&gt;37x to 63x&lt;/td&gt;
&lt;td&gt;A bug in the unreleased v0.2 rewrite, never shipped. The point is the flat after column; the before column is not monotonic in size.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;incr's spreadsheet-grade milestone prototype: edit the last row of a running sum&lt;/td&gt;
&lt;td&gt;1.7 ms → 2.5 µs&lt;/td&gt;
&lt;td&gt;680x&lt;/td&gt;
&lt;td&gt;Measured on a shared box during development; not a release figure.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Same prototype: no-op evaluate once the recalculation fingerprint stopped hashing names, tables, hidden rows and parsed formulas&lt;/td&gt;
&lt;td&gt;21 ms → 4 µs&lt;/td&gt;
&lt;td&gt;5,000x&lt;/td&gt;
&lt;td&gt;Same as above. Writes that bypass the public mutators are not tracked in release builds (a documented limitation).&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Dependency publish diffs through hash sets above 16 entries instead of O(old × new), 50,000 dependencies&lt;/td&gt;
&lt;td&gt;78 s → under 1 s&lt;/td&gt;
&lt;td&gt;at least 78x&lt;/td&gt;
&lt;td&gt;The after figure is an upper bound, so the factor is a floor. Publishes that miss the fast path cost about 14 instructions more on Local and 4 on Shared.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Long-chain replay with an indexed path lookup, 100,000-link chain, wasm release build&lt;/td&gt;
&lt;td&gt;28.4 s → 0.72 s&lt;/td&gt;
&lt;td&gt;39x&lt;/td&gt;
&lt;td&gt;Native first compute is linear (0.46 s at 100,000 links); the wasm figure is the one with a before.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Cycle resolution with a held-state index instead of whole-map scans, 100,000-node ring with a fallback strategy&lt;/td&gt;
&lt;td&gt;about half an hour → about 2 s&lt;/td&gt;
&lt;td&gt;about 850x&lt;/td&gt;
&lt;td&gt;The after figure is approximate; peak memory at most 208 MB. A development-branch figure, later merged.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;&lt;td colspan="4"&gt;&lt;strong&gt;The live service's engine design&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Design rules the benchmark found (a separate bulk writer, a process-wide bulk gate, heavy queries in a process pool, a GC freeze with a raised gen2 threshold), measured during a full bulk recomputation on the large synthetic data set: p99 to apply an interactive event&lt;/td&gt;
&lt;td&gt;876 ms → 8.7 ms&lt;/td&gt;
&lt;td&gt;100x&lt;/td&gt;
&lt;td&gt;Cumulative design changes from the first cut to the fifth iteration, not a single fix; same harness, host and data set. Host load for those runs was not recorded. The accepted run later gave 7.7 ms.&lt;/td&gt;
&lt;/tr&gt;
    &lt;tr&gt;
&lt;td&gt;Same rules: p95 interactive edit end to end; p95 from event commit to the engine reading it; p95 what-if read over 300 alternatives&lt;/td&gt;
&lt;td&gt;33.4 s → 44 ms; 19.1 s → 20 ms; 3,971 → 161 ms&lt;/td&gt;
&lt;td&gt;about 760x, about 950x, 25x&lt;/td&gt;
&lt;td&gt;Same as above. The accepted run later gave 35 ms for the edit and 142 ms for the what-if read, against a 300 ms bar.&lt;/td&gt;
&lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Other benchmarks
&lt;/h2&gt;

&lt;p&gt;The first prototype of the service ran on beta.6 with provisional graphs, and &lt;code&gt;incr-kube&lt;/code&gt; is benchmarked in the incr repository against the store it replaces:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Benchmark&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Against&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Prototype (synthetic) apply, during a full pass&lt;/td&gt;
&lt;td&gt;p99 7.7 ms (p95 5.1, max 22.4)&lt;/td&gt;
&lt;td&gt;bar 50 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prototype (synthetic) event to committed output&lt;/td&gt;
&lt;td&gt;p50 5.8, p95 35, p99 71 ms&lt;/td&gt;
&lt;td&gt;bar 500 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prototype (synthetic) what-if read, 300 alternatives&lt;/td&gt;
&lt;td&gt;p95 142 ms (p99 218)&lt;/td&gt;
&lt;td&gt;bar 300 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prototype (synthetic) sustained load&lt;/td&gt;
&lt;td&gt;100 events/s for 300 s, all 30,002 applied&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prototype (synthetic) graph size&lt;/td&gt;
&lt;td&gt;about 929k nodes in 1,107 MB&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;incr-kube&lt;/code&gt; writer, 1,000 events/s offered&lt;/td&gt;
&lt;td&gt;target met, 7 to 8 µs mean&lt;/td&gt;
&lt;td&gt;kube-rs &lt;code&gt;Store&lt;/code&gt;: 444 to 506 events/s (about 2x)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;incr-kube&lt;/code&gt; reader, 1% selected&lt;/td&gt;
&lt;td&gt;about 100 µs&lt;/td&gt;
&lt;td&gt;kube-rs &lt;code&gt;Store&lt;/code&gt;: about 2 ms (about 20x)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;incr-kube&lt;/code&gt; reader, 50% selected&lt;/td&gt;
&lt;td&gt;15.6 ms, slower&lt;/td&gt;
&lt;td&gt;kube-rs &lt;code&gt;Store&lt;/code&gt;: 4.8 ms&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The prototype ran 20 data sets (one large plus 19 at 5% size) on synthetic data in a 4-vCPU, 8 GiB VM. The graph held about 1.2 KB per node, mostly Python values. Cold hydration took 25.9 s there against 434 s on the real graphs, a full pass over all 20 sets took 85.6 s, and the drift check found zero mismatches in five runs. The &lt;code&gt;incr-kube&lt;/code&gt; numbers are for 50,000 objects with 4 readers; at 50% selectivity &lt;code&gt;incr-kube&lt;/code&gt; is the slower choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two stories from production
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Steady memory rose on beta.11.&lt;/strong&gt; On idle controls, steady memory went from 5,678 to 6,341 MiB (about 12%). beta.11 keeps the rendered trace of every traced root, about 2.75 KB each across about 271k roots, with no opt-out, and that memory does not show up in &lt;code&gt;memory_stats&lt;/code&gt;. The service accepted the cost, and it is filed with incr as a request for a compact or opt-out form.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Round trips and transactions.&lt;/strong&gt; One memo read per entry meant about 590k round trips, which pushed a restore past 120 s and into a cold fallback; reading in pages of 1,024 fixed it. A cold hydrate under persistence wrote one transaction per row, taking 257 s against 36 s on a small set; one batch per chunk brought it to 9.8 s (26x).&lt;/p&gt;

&lt;h2&gt;
  
  
  What incr does not fix, or still costs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cold hydration.&lt;/strong&gt; It takes 434 to 650 s on the large data set, and that time goes to Python-side decoding and building, not to incr. incr makes restarts and takeovers avoid it; it does not make it cheaper. Idle restart still sits close to its bar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory.&lt;/strong&gt; A hydrated graph takes 3.7 to 4 GiB, and 5.3 to 6.6 GiB with the persistence path. A hot standby doubles that. incr's own share is hard to see from Python.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Python.&lt;/strong&gt; The GIL is held during propagation and callbacks are synchronous, so writes have to stay short and batched. Memo entries cannot depend on a whole collection.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared.&lt;/strong&gt; The concurrent flavour has no overlay yet, and it had wrong-value cases around cycles and replay, with a residual 0.5% differential race still open.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Release cadence
&lt;/h2&gt;

&lt;p&gt;Seven betas shipped in under three weeks, and beta.10 and beta.11 were &lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;delivered by a crew of Claude Code sessions&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: beta.6 to beta.12, from the CHANGELOG. The two gold releases came from a crew run.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Release timeline. beta.6 on 29 October: cycles as values, watch, node tables, replay for deep chains. beta.7 on 8 November: Python persistence, overlay, keyed collections, bulk apply. beta.8 on 15 November: per-key reads, memo durability owned by incr, compute stats, trace edges. beta.9 on 15 November: store calls from Drop no longer hang, bounded GIL holds in checkpoints. beta.10 on 17 November: delta memo checkpoints, forget key, key-set reads. beta.11 on 17 November: streamed store compaction, lazy collection fingerprints. beta.12 on 17 November: relicense, no engine change.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/incr-in-a-live-service" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;beta.12 relicensed incr to AGPL-3.0-only with a commercial option; beta.11 and earlier remain under Apache-2.0.&lt;/p&gt;

</description>
      <category>rust</category>
      <category>python</category>
      <category>incrementalcomputation</category>
      <category>performance</category>
    </item>
    <item>
      <title>Crew: one Claude Code session that runs an engineering team</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Tue, 17 Nov 2026 16:11:16 +0000</pubDate>
      <link>https://dev.to/anyesh/crew-one-claude-code-session-that-runs-an-engineering-team-3olg</link>
      <guid>https://dev.to/anyesh/crew-one-claude-code-session-that-runs-an-engineering-team-3olg</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Crew turns one Claude Code session into a lead that runs a team of worker sessions in Herdr. The lead never writes code. It keeps a board of items with dependencies, gives every ready item to a worker in its own git worktree, rules on questions, replaces workers that stall, and is the only session that talks to me. Every item lands through a merge gate that runs the repository's full checks on the exact merged commit, so main stays green. On a private product, six crew runs boarded 635 items, and crew branches merged 534 times in 17 days. incr's crews shipped its beta.10 and beta.11 releases; beta.11 went from plan to tag in about five hours. It broke in specific ways too, and the fixes that held were mechanisms, not written rules.&lt;/p&gt;

&lt;p&gt;In &lt;a href="https://anyesh.me/writing/claude-code-sessions-as-a-team" rel="noopener noreferrer"&gt;the last post&lt;/a&gt; my sessions worked as peers: one per repository, each messaging the others when it needed something from their side. Crew puts one session in charge: a lead that decides what comes next, who owns each change, and what is allowed to reach main.&lt;/p&gt;

&lt;h2&gt;
  
  
  The shape
&lt;/h2&gt;

&lt;p&gt;A crew has five parts.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Me.&lt;/strong&gt; I give goals, product taste and the decisions that need my authority: production deploys, spend, brand. Technical calls and many product calls are delegated to the lead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The lead.&lt;/strong&gt; One long-lived Claude Code session. It starts worker sessions in Herdr, one tab per worker, and talks to them through Herdr. It keeps the board, answers questions, rules on scope and performance calls, replaces workers that stall or run out of room, and relays every result to me. I talk to one voice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workers.&lt;/strong&gt; Each one owns exactly one board item and works in its own git worktree on its own branch. It reads the spec, builds, tests what it touched, reports back (done, question, blocked or hand-off) and lands the item through the gate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The board.&lt;/strong&gt; A plain list of items, each with an owner, a status, a target branch, a deliverable and its dependencies. Only the lead edits it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The merge gate.&lt;/strong&gt; Nothing reaches main until the repository's full checks pass on the exact merged result.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The lead runs a check loop. Each pass reports finished work, workers that are blocked or have gone quiet, pressure on the machine, workers nearing their limits, leftovers from items that already landed, and items whose dependencies just landed. The lead acts on all of it in the same turn and loops again. Between passes it writes down its rulings, keeps a handover note, and runs a recurring reflection round that turns mistakes into enforced rules.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The lead's loop. Each pass goes round the whole circle and acts on everything it finds in the same turn; I only ever talk to the lead.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The lead's check loop drawn as a circle with four stations: the board of ready items and owners, the workers with one worktree per item, their reports of done, question, blocked or hand-off, and the lead's rulings, which feed back to the board. The lead sits in the middle and never writes code. I sit outside the loop and talk only to the lead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Life of an item
&lt;/h2&gt;

&lt;p&gt;A crew starts from a plan or a list of items. The lead splits a plan into ordered items with dependencies, and an item becomes ready the moment its dependencies land; the lead assigns every ready item in the same turn rather than one at a time. A worker builds the item, and independent reviewer agents check its plan and its change. The worker iterates review rounds until the change comes back clean, and only then queues for the gate. One change ran 11 review rounds before it landed; another took seven in-branch rounds, all of them on race conditions.&lt;/p&gt;

&lt;p&gt;Workers are not order-takers. I made the ruling explicit on 14 November: members act like accountable senior engineers, challenge the plan, and own the cost of what they run. A worker may push back on the spec or on the lead with evidence, and the lead rules on that evidence.&lt;/p&gt;

&lt;p&gt;The gate is what lets many workers share one main branch. Queued items are merged together in a temporary merge and checked as a batch. If the batch is green, all of them land. If it is red, the batch is split until the failing item is cut, and the rest land without it. Main stays green, and the cost of a long check is shared by every item queued behind it. A gate is only valid for the commit it checked, so a main that moves mid-gate invalidates every running gate; bulk landings are batched and announced for that reason.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: One item's path, and what the gate does with a red batch. Every check runs on the exact merged commit, not on the branch alone.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Top: one item's path from a board row to a worker, its worktree, build and test, review, which can loop back to build for another round, the gate, main, and cleanup. Bottom: the gate checks four queued items A, B, C and D as one merged batch. The batch is red, so it splits into A and B, which pass and land, and C and D, which fail. That half splits again: C passes and lands, D fails and is cut back to its worker. Main receives A, B and C and stays green.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Sessions have limits, and a long item can outlast one. A worker that nears the end of its room writes a hand-off note; the lead closes it and gives the item, the worktree and the note to a fresh worker, which picks up where the first one stopped. The lead does the same for itself, passing the whole crew to a successor session.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: A hand-off moves the session, never the work: the item, its worktree and its branch stay put.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Worker A fills up and writes a hand-off note. The lead closes A and starts worker B with the note. Both sit on the same item's worktree and branch, which carry over untouched. The lead hands itself over the same way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One rule keeps all of this from leaving debris: whoever starts a tab, process, stack, worktree or branch removes it, and the lead sweeps leftovers on every pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the shape holds
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The lead never writes code.&lt;/strong&gt; Its context stays small and its time stays free for coordination. A lead that stalls stalls everything, so it is the one session kept off the critical path of any single item.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One owner and one worktree per item.&lt;/strong&gt; No two sessions ever edit the same tree, ownership is never in doubt, and cleanup is mechanical.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The gate runs on the exact merged commit, in batches, with bisection.&lt;/strong&gt; Main stays green, and one long check covers every item queued in the batch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ordered items with dependencies.&lt;/strong&gt; A large plan becomes a graph, and work starts on each node the moment it can.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The machine is shared.&lt;/strong&gt; On a small machine, the memory-heavy jobs (container stacks, browser checks, the gate itself) take turns rather than fighting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before crew there was an earlier multi-agent system of mine, retired in late October, with a merge queue, a verification stage on a real stack, ticket culture and sandboxed agents. Crew is lighter and lives in the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it built
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A private product
&lt;/h3&gt;

&lt;p&gt;The product's first waves, from 27 to 31 October, were built with parallel orchestrated chunks (16 chunks in one wave; 13 chunks and 28 fixes in the next). On 1 November the remaining waves moved to a Herdr crew, and the board history since then sits in six archived runs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Items per archived crew run on the private product, 1 to 17 November. A seventh run had 10 items open on 17 November.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Horizontal bars of items per archived crew run: run 1, 94 items; run 2, 10; run 3, 52; run 4, 191; run 5, 167; run 6, 121. 635 items in total, 529 of which carry a landed-merge marker.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Across those 17 days, 534 merge commits name a crew branch. Some of the runs, by what they delivered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The initial build crew finished on 3 November with all 94 of its board items done, plus an accessibility sweep of 1,786 scans over 893 states with zero accessibility violations.&lt;/li&gt;
&lt;li&gt;A UX polish run landed 51 items on main on 5 November.&lt;/li&gt;
&lt;li&gt;On the night of 14 November, five items landed overnight.&lt;/li&gt;
&lt;li&gt;Docs and marketing pages ran as crew items too.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The crew also found real defects while building. One handler held a database transaction open across network calls, which stalled a database reset for more than ten minutes. The fix was made for the whole class rather than the one handler: every outbound call now goes through one boundary.&lt;/p&gt;

&lt;p&gt;Commit counts say little about a crew, since every item lands as its own branch and merge; for the record, the repository took 7,511 commits over those 17 days (inferred from daily counts).&lt;/p&gt;

&lt;h3&gt;
  
  
  incr
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/projects/incr" rel="noopener noreferrer"&gt;incr&lt;/a&gt;, my open-source incremental-computation library in Rust with Python bindings, ran crews of its own. A week-long run in late October shaped the reflection loop described below; the beta.10 crew had 14 items, one large design split into eight plus an end-to-end item; beta.11 went from plan to tag in about five hours with three workers, shipping three requested features. The product's crew filed its asks to incr as numbered requests, and the lead tracked that request page so none went stale. beta.9 to beta.12 were tagged between 15 and 17 November (beta.12 is a licence change). Measured on the product, hot standby takes over in 2.09 s against 434 s cold (about 800k output rows over 10 tables identical before the kill, after promotion and against a later cold hydrate; off by default, and a standby doubles memory), delta checkpoint nights take 0.7 to 1.0 s against 44.4 s and 48.1 s full writes, idle restart dropped from 70 s on beta.10 to 54 s on beta.11 on the same host and harness, and zero of 2,748,751 results were wrong against a recompute without incr.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Standby takeover and nightly checkpoint times with incr, measured on the product. Store checkpoint and compaction did not get shorter.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two bar panels. Standby takeover on the large test data set: cold standby 434 seconds, hot standby 2.09 seconds. Nightly checkpoint: full writes of 44.4 and 48.1 seconds, delta nights of 0.7 to 1.0 seconds, and 0.6 seconds on beta.11.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  A private library
&lt;/h3&gt;

&lt;p&gt;A crew on a private library started with six items on 5 November and reached at least 20 by the next day. Items there got reviewed plans before any code. One plan section never came back clean after ten review rounds, so it was redesigned instead of patched again. A review on another item found file descriptors leaking into a concurrently started child process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it broke
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;One shared slot set the pace.&lt;/strong&gt; On 3 November, once only QA items remained, landings came about one every 50 minutes, and merges had to be moved ahead of queued sessions by hand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Waiters polled a lock instead of queueing.&lt;/strong&gt; One item waited over an hour while others jumped ahead of it. Arrival-ordered tickets fixed it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nobody questioned a wait.&lt;/strong&gt; Three items waited 30 to 50 minutes on a slot whose holder sat idle editing code. The lead now questions every wait.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A bootstrap script reseeded the main checkout's dev database.&lt;/strong&gt; It printed database URLs but only wrote an env file; it now fails closed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An orphan waiter came back to life.&lt;/strong&gt; A restarted long-run waiter script was still alive. Because the shell re-reads a running script, it picked up its replacement's edits and launched a duplicate load run once a lane freed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The lead handed the crew back to me.&lt;/strong&gt; A lead hit its own session limit, stopped, and told me to restart it; the crew sat leaderless with two workers stalled. Since then the lead swaps itself and its workers out and never hands the crew back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I moved main mid-gate.&lt;/strong&gt; Two streams of my own approval commits (124 and 91 of them) forced a roughly 40-minute gate to rerun twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A VM said "Running" while its port forwarding was dead,&lt;/strong&gt; and every gate failed until it was restarted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Builds over-ran.&lt;/strong&gt; Workers rebuilt stacks and reran suites on every attempt until cached images, a stack kept running with hot reload, and tests scoped to what each change touched replaced that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The single voice slipped.&lt;/strong&gt; A worker published a page the lead never relayed, so I picked a logo by talking to the worker directly. The rule is now that everything comes through the lead.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Rules don't stick; mechanisms do
&lt;/h2&gt;

&lt;p&gt;The reflection round writes lessons down, and for a while the lessons only grew. The lesson file reached 432 lines (104 KB) while the largest classes of mistakes kept happening anyway. It was rewritten into 54 class rules (8 KB): each one names a class of mistake, not an incident. The cap comes with an escalation. When a class fails again despite its rule, the fix becomes a board item that builds a check into the tool, because a written rule had already shown it would not hold.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The lesson loop with a size cap. A rule gets one chance per class; a repeat turns it into a check.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Top: a mistake becomes a class rule naming the class rather than the incident. If the same class fails again, it becomes a mechanism, a check built into the tool. Bottom: the lesson file before, 432 lines and 104 KB, against after, 54 class rules and 8 KB.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-crew" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The lead needed the same treatment. It drifted: relays came late, cleanups came late, figures went stale. Several of my corrections became standing rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Gate runs take 21 to 45 minutes; incr's gate takes about 45 under load. A main that moves invalidates them.&lt;/li&gt;
&lt;li&gt;Session limits sometimes stalled workers before they could write their own hand-off note.&lt;/li&gt;
&lt;li&gt;One small machine could run one heavy job at a time. Heavy work moved to a larger Linux box and a GPU box as they became available.&lt;/li&gt;
&lt;li&gt;Not all effort is useful effort: one night's audit found about 10 of 51 heavy runs wasted.&lt;/li&gt;
&lt;li&gt;There is no controlled comparison against a human team or against a single agent, so I make no claim of a speedup multiple. What the numbers above show is what one lead, a board and a gate delivered, and where each of them failed along the way.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>aiagents</category>
      <category>claudecode</category>
      <category>developertools</category>
      <category>workflow</category>
    </item>
    <item>
      <title>My Claude Code sessions work as a team, and they message each other</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Tue, 13 Oct 2026 04:03:51 +0000</pubDate>
      <link>https://dev.to/anyesh/my-claude-code-sessions-work-as-a-team-and-they-message-each-other-18b8</link>
      <guid>https://dev.to/anyesh/my-claude-code-sessions-work-as-a-team-and-they-message-each-other-18b8</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I run one Claude Code session per repository and let them message each other instead of editing each other's code. The messaging ships with Claude Code (&lt;code&gt;ListAgents&lt;/code&gt; and &lt;code&gt;SendMessage&lt;/code&gt;). Running six to nine of them at once works because of a harness that keeps cache costs visible, pushes to my phone when a session is waiting, logs every action a guard blocks, and carries context across resets. Over three and a half weeks, 81 sessions sent each other 624 messages, and cross-repository requests that would have gone through me now go straight from one session to another.&lt;/p&gt;

&lt;p&gt;On a busy day six to nine Claude Code sessions are active on my machine in the same hour, each one sitting in its own repository: Loom, the research repos that feed it (unlearn, redraft, JEV-like-research, memories-for-llms), second-brain, a memory service, wardrowbe, the harness that configures all of them. Each session owns its repository and nothing else. When one needs something from another repository, it doesn't open those files and edit them; it messages the session that owns them, and that session does the work in its own domain and replies.&lt;/p&gt;

&lt;p&gt;Between 18 September and 12 October, 81 sessions across 13 projects sent each other 624 messages. The busiest day was 1 October, with 200. The most sessions active in a single hour was nine, on three separate days.&lt;/p&gt;

&lt;h2&gt;
  
  
  One session per repository
&lt;/h2&gt;

&lt;p&gt;The setup is easiest to see in how I start a day's work. This is the opening prompt of a Loom session on 29 September, verbatim:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;we were working on some advanced feature for loom where we were brigining up our various research we have like evoke(unlearn), jev, memories-for-llms, redraft etc. ... This is opus main session. You can spawn other child sonnet with appropriate effort level to do your work. main session is the orchestration and managing session. you will have all the context and you will pass in around as needed. AND additionally there are other agents on each project ready to colab with you on any related tasks. you can directly contact them and make them work on their own domain if needed. good luck!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Twenty minutes later that session called &lt;code&gt;ListAgents&lt;/code&gt; and found itself as &lt;code&gt;loom-1d&lt;/code&gt;, with four peers that had all started 23 minutes earlier: &lt;code&gt;unlearn-e6&lt;/code&gt;, &lt;code&gt;redraft-20&lt;/code&gt;, &lt;code&gt;jev-like-research-65&lt;/code&gt; and &lt;code&gt;memories-for-llms-8a&lt;/code&gt;. Loom is the hub of that team because it's where the research gets integrated; each research repository has its own session that knows its own code, its own experiments, and its own history.&lt;/p&gt;

&lt;p&gt;There are two levels of delegation here and they're different things. Inside one session, the Opus main session spawns Sonnet subagents for bounded pieces of work and reviews what comes back. Across sessions, the peers are full Claude Code sessions with their own context, their own permission prompts, and their own person approving things, which happens to be me in every case.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The team from the 29 September kickoff. Highlighted lines are cross-session messages between peers; the dashed boxes are subagents the hub spawns and discards inside its own session.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The team on 29 September. The Loom session sits in the middle as the hub and spawns short-lived Sonnet subagents beneath it. Four peer sessions, unlearn, redraft, JEV-like-research and memories-for-llms, sit around it, each inside its own repository, connected to Loom by two-way message lines. A note marks that each session has its own approvals.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-sessions-as-a-team" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How they talk
&lt;/h2&gt;

&lt;p&gt;The messaging itself isn't something I built. Claude Code ships two tools for it: &lt;code&gt;ListAgents&lt;/code&gt; shows the other sessions running on the machine, and &lt;code&gt;SendMessage&lt;/code&gt; delivers text to one of them over a local Unix socket. The receiving session sees the message wrapped in a &lt;code&gt;&amp;lt;cross-session-message from="..." from-name="app-c6"&amp;gt;&lt;/code&gt; block at its next tool round, so a busy session finishes the step it's on before reading it, and replies by sending back to the &lt;code&gt;from&lt;/code&gt; address. My harness doesn't wrap, extend, or configure any of this. What it does is make running this many sessions at once cheap enough and safe enough to keep doing, which comes further down.&lt;/p&gt;

&lt;p&gt;The sessions sit in panes in &lt;a href="https://herdr.dev" rel="noopener noreferrer"&gt;herdr&lt;/a&gt;, a terminal multiplexer that knows which panes hold coding agents and whether each one is working, blocked, or done. On 10 October &lt;code&gt;herdr agent list&lt;/code&gt; showed four Claude sessions in one workspace: three working, in an app repository, the harness and my home directory, and one blocked, in wardrowbe, waiting on me. Herdr's own log has up to about twenty Claude panes alive on a single day.&lt;/p&gt;

&lt;h2&gt;
  
  
  What they say to each other
&lt;/h2&gt;

&lt;p&gt;The useful part is what the messages are for, so here are five of them as they were sent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An API change and a release, across two repositories.&lt;/strong&gt; A Rust memory service of mine depended on second-brain through a pinned git revision and needed a private method made public. On 18 September its session wrote to the second-brain session:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;[The memory service] needs a second-brain release it can depend on from crates.io instead of its git rev pin. ... Two asks: (1) make &lt;code&gt;MaintenanceOps::backfill_embeddings&lt;/code&gt; public, or expose it through a public method that runs only the embedding backfill, not the rest of repair() ([it] must not run the cross-project merging); (2) cut a release ... Please reply with the version number once it is published, or tell me if something blocks it. No rush over your current audit work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The reply came fifteen seconds later, and it pushed back on the order: second-brain was midway through an audit whose fixes also affected the memory service, so the release should wait for them and would likely be 0.9.0, "because it adds public API and changes behaviour". It also said publishing to crates.io can't be undone, so it was getting my go-ahead first. Five days later the release landed:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;second-brain 0.9.0 is on crates.io with a public backfill_embeddings: all six crates are published (core, adapters, sync, mcp, api, cli), tagged v0.9.0.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The memory service moved onto it, and Loom, which runs it, checked the change and confirmed it needed no changes on its side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A turn on the GPU.&lt;/strong&gt; One GPU box is shared by three research repositories, and on 27 September memories-for-llms needed it for an experiment window. It asked Loom to "book 100 minutes on [the GPU box]; I expect it to take 45 to 55." Loom, acting as the scheduler, told the unlearn session to step off:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please step off [the GPU box] now. The user has cleared window 1 (memories-for-llms) to start immediately, booked for 100 minutes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stop your scheduled task and any process of yours using the GPU, and reply to me with "stopped" once VRAM is released (show the nvidia-smi line).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the same minute it corrected memories-for-llms' stop script, because "killing every llama-server by image name would take down anything of anyone's on the box." The unlearn session couldn't comply right away: it was in plan mode, which blocks anything that changes the system, so it said it was asking me. I approved it, it replied &lt;code&gt;stopped, VRAM released&lt;/code&gt;, and Loom opened the window: "unlearn-97 has stopped EVOKE, and nvidia-smi shows the GPU idle." From the booking request to the window opening took five minutes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A merge with ground rules.&lt;/strong&gt; On 3 October the verdict session in JEV-like-research needed work merged into Loom's main. Loom had already set the terms:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please do it on a branch in its own worktree rather than in the [main loom] checkout: I merge several branches into main from that checkout through the day, and uncommitted edits there would collide with those merges.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Verdict did that, ran the gates, and asked Loom to merge the four commits. Loom asked it to hold its service restart until the merge was done, then reported back: "merged into loom main and pushed; gates passed. You can go ahead with the verdict restart."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Waiting for everyone before a deploy.&lt;/strong&gt; Several sessions often work in one app repository at once. Before a production deploy on 4 October I asked one of them to wait for all the others, and it broadcast:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please message [me] when your work is committed and finished; I'm waiting on you before a prod deploy. ... send me one line covering three things: (1) you're finished and the tree is clean of your changes, (2) your last commit hash, and (3) whether your work adds a database migration or needs anything special in prod ...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;One session answered "Not finished yet", still editing UI files; thirteen minutes later it reported "Finished: every change from my session is committed and the tree has none of my changes; I won't commit again," with its last commit hash and its one migration, and the deploy went out with its commits included.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Asking a peer what it measured.&lt;/strong&gt; On 4 October Loom wanted a seven-hour training job made faster without a bigger GPU, and asked memories-for-llms, which had trained every adapter so far, for "your measured knowledge, not guesses". Two minutes later the answer started: "almost none of the knobs you named was ever measured. Details with citations follow; I read files only and did not touch [the GPU box]."&lt;/p&gt;

&lt;p&gt;Not every message is between related projects. On 12 October a session making a video built a new skill straight into &lt;code&gt;~/.claude/skills&lt;/code&gt;, then told the harness session to adopt it. The harness session moved it into the harness, ported a follow-up, and replied: "collage-film now lives in the harness at [harness]/configs/shared/skills/collage-film; please don't edit ~/.claude/skills/collage-film any more, because install.sh overwrites it from there."&lt;/p&gt;

&lt;h2&gt;
  
  
  The harness under it
&lt;/h2&gt;

&lt;p&gt;All of these sessions run on the same &lt;a href="https://github.com/Anyesh/harness" rel="noopener noreferrer"&gt;harness&lt;/a&gt;: one repository that renders the configuration, hooks, rules, skills and MCP servers for Claude Code, Cursor, Codex and opencode. Running nine sessions at once changes what the harness has to do, and most of the pieces below exist because of a specific failure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cost
&lt;/h3&gt;

&lt;p&gt;The costliest failure the harness has recorded is a large context whose prompt cache expired. A Claude Code main session's cache lasts an hour idle and a subagent's about five minutes; the first turn after a longer gap re-sends the whole context at the cache-write price. Orchestrating sessions had been running subagents for 8 to 24 hours while the main session waited, so the rules now cap subagent work to minutes, never resume a large-context agent after a gap, and keep builds and long suites in background shells on the main session.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;cache-guard&lt;/code&gt; mod, further down, puts that clock on the status line so the rule doesn't depend on anyone remembering it.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;/orchestrate&lt;/code&gt; command splits a plan into independent workstreams, has a bigger model review the split first, runs the streams as parallel subagents in their own worktrees where files would collide, and leaves the merge and the full test run to the main session.&lt;/p&gt;

&lt;h3&gt;
  
  
  Attention
&lt;/h3&gt;

&lt;p&gt;With nine sessions, the bottleneck is noticing which one is waiting on me. A hook sends a push to my phone when any session has been blocked on a question or a permission for fifteen seconds, or has finished a turn for sixty, and cancels the push if I answer first. In one eighteen-hour stretch on 12 and 13 October it sent 35 blocked pushes and 16 finished ones, and 34 of the 35 blocks were answered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hygiene
&lt;/h3&gt;

&lt;p&gt;Parallel sessions leave worktrees behind. The rule is that whoever creates a worktree removes it, and a sweep at session start removes any worktree idle for a day whose commits have all landed, saves uncommitted files to &lt;code&gt;.git/worktree-salvage/&lt;/code&gt;, and keeps any branch with work that hasn't landed. Each session's status files, block log entries and handoff digests are keyed by its session id, so two sessions in the same repository never write over each other's state.&lt;/p&gt;

&lt;h3&gt;
  
  
  Guards
&lt;/h3&gt;

&lt;p&gt;Hooks block specific things before they happen, and every block is logged so I can replay a guard change over real transcripts before shipping it. Between 3 and 12 October they blocked 140 actions: 45 bare &lt;code&gt;rm&lt;/code&gt;/&lt;code&gt;cp&lt;/code&gt;/&lt;code&gt;mv&lt;/code&gt; calls that would have hit interactive aliases, 33 writes breaking the code-quality rules (em dashes, smart quotes, emoji, inline imports), 26 narrating code comments, 18 unbounded reads or command outputs on a main session, 17 attempts to stop a session after code changes with nothing recorded in the wiki, and one remote shutdown of the GPU box.&lt;/p&gt;

&lt;h3&gt;
  
  
  Memory
&lt;/h3&gt;

&lt;p&gt;Two stores outlive any single session. second-brain ingests every Claude Code and Cursor transcript and consolidates it into memories any session can recall over MCP; it currently holds 11,255 live memories distilled from 4,880 transcript files. The wiki is an Obsidian vault that sessions write decisions, plans and a dated devlog into, enforced by hooks, which I wrote about in &lt;a href="https://anyesh.me/writing/wiki-devlog-agent-memory" rel="noopener noreferrer"&gt;an earlier post&lt;/a&gt;. Between them, a session that starts cold on a repository it hasn't touched in a week has somewhere to look first.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mods
&lt;/h3&gt;

&lt;p&gt;Hooks can block an action or add text to the conversation, but they can't show anything. Claude Code mods can: a plugin can add a segment to the status line, a band above the prompt, a toast, or a slash command. The harness ships five, all added on 11 October, and with them each of the nine panes tells me at a glance which session is about to get expensive, which one hit a guard, and which one hasn't written its scope or devlog.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;cache-guard&lt;/strong&gt; learns the real cache lifetime from the hits and misses it observes, then shows the time left on the status line: &lt;code&gt;cache 42m · agents 3 · 1 cold&lt;/code&gt;. Once the cache has expired, the segment turns yellow and shows what the next prompt will cost to re-write (&lt;code&gt;cache cold ≈ $X&lt;/code&gt;). If an idle prompt would re-bill a dollar or more, it stops and asks whether to send anyway, compact first, or keep the prompt as a draft. After a cold turn that re-wrote 50,000 tokens or more, it raises a toast with the cost.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;guard-watch&lt;/strong&gt; counts every call a guard denied and shows &lt;code&gt;N blocks&lt;/code&gt; on the status line. It raises a toast when a guard blocks a subagent, because those blocks never reach the main transcript, so a subagent could otherwise route around a guard without the main session knowing it had been refused.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;nudge-band&lt;/strong&gt; puts a band above the prompt when &lt;code&gt;.scope.md&lt;/code&gt; is missing or stale, when nothing has gone into the wiki this session, or when untracked files are piling up, with buttons that pre-fill &lt;code&gt;/scope&lt;/code&gt;, &lt;code&gt;/devlog&lt;/code&gt; or a cleanup prompt. It replaced three shell hooks that did the same job by injecting reminders into the conversation, where every reminder cost context in every later turn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;handoff&lt;/strong&gt; runs when a session compacts or is cleared. A shell script collects the facts (files touched, repository state, the last plan, the newest turns) without a model call, and a tool-less fork of the session writes the goal, the next step, the decisions, what was ruled out, open questions, and how to verify. The session that published this post started from a cleared context, read one of those digests, and already knew the draft had been reviewed, which four problems the review found, and that a second post was sitting uncommitted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;context-audit&lt;/strong&gt; adds &lt;code&gt;/context-audit&lt;/code&gt;, which totals what the context is spending on MCP servers, skills, memory files, agents and commands, and names up to five things to trim.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Every session runs on the same harness and shares the same two stores. The highlighted lines between panes are Claude Code's own cross-session messages; everything else is the harness.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Layers of the setup. At the top, herdr panes, each holding one Claude Code session in its own repository. The sessions are joined by cross-session messages. Beneath every session is the same harness layer: cost rules and cache-guard, attention pushes, worktree sweep, guards. At the bottom, two shared stores every session reads and writes: second-brain and the wiki vault. A phone receives attention pushes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/claude-code-sessions-as-a-team" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Where it breaks
&lt;/h2&gt;

&lt;p&gt;Sessions die and their addresses go stale. A session's address is its socket, and a restarted session gets a new one. A send to the old one fails with &lt;code&gt;ENOENT ... the peer process may have restarted, so this socket path is stale&lt;/code&gt;. The sender usually recovers by listing peers again; when the peer is gone for good, the best it can do is what one did on 30 September: "The wardrowbe-b8 session is gone (its socket no longer exists and it isn't among the live peers), so I'm saving the report where it can be picked up later." When an orchestrating session was about to be replaced, it had every peer also append its reports to a shared inbox file, so a change of name wouldn't lose anything.&lt;/p&gt;

&lt;p&gt;A reset session forgets what it asked for. The memory service asked second-brain for the same release twice, five days apart, because its second session had no memory of the first request. Redraft reported two items as outstanding that had been done three days earlier, then corrected itself: it had "only looked at loom's committed copy and the redraft repo."&lt;/p&gt;

&lt;p&gt;Messages go to the wrong session. On 11 October Loom sent a landing-page brief to the wrong peer and had to follow up: "Please ignore my earlier message about the Loom landing page; I sent it to the wrong session by mistake. No reply needed." The deploy broadcast also reached a Loom session, which answered that it wasn't working in that repository.&lt;/p&gt;

&lt;p&gt;Every session commits as me. When the verdict session found a commit it hadn't made in a checkout it was working in, it asked the harness session whether it was the author. It wasn't, and nothing in git could say which session was, because all of them commit under the same name.&lt;/p&gt;

&lt;p&gt;Two sessions can start the same work. Once, a session found a peer on the same project already building the thing it had just planned to build.&lt;/p&gt;

&lt;p&gt;Each session still has its own human gate. unlearn couldn't stop its GPU process until I approved it, and second-brain wouldn't publish to crates.io without my go-ahead, which is how it's meant to work: a session can ask a peer to act, but it can't use the peer to get around an approval it would need itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it adds up to
&lt;/h2&gt;

&lt;p&gt;Commit counts don't measure this well, and I checked. My weekly commit rate across every repository more than doubled after August, but almost all of the increase is Loom, which didn't exist before September. Outside Loom the rate didn't rise, and in some repositories it fell. What changed is how much runs in parallel and who carries information between the parallel parts. On 1 October nine projects had live sessions, and they exchanged 200 messages that day: API requests, GPU bookings, merge requests, deploy barriers, measured answers with citations. I didn't relay any of them. Some started with a request from me, like the deploy wait, and some stopped for my approval partway, but what reaches me now is mostly the decisions only I can make: an approval in plan mode, a crates.io publish, a production deploy, and a phone push when one of them is waiting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to take from this
&lt;/h2&gt;

&lt;p&gt;If you run more than one agent session, these are the parts that carry over to any setup, not only mine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Give every repository one owner, and make cross-repository work a request.&lt;/strong&gt; The owning session knows what a visitor doesn't: that a migration number is reserved, that the main checkout takes merges all day, that killing every &lt;code&gt;llama-server&lt;/code&gt; by name would take down someone else's job. In four of the five exchanges above, the owner caught something the asker would have broken or got wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the human gate per session.&lt;/strong&gt; A peer can ask another session to act, but it can't borrow that session's permissions. Plan mode and the crates.io approval both held while the requests came in over messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;With many sessions, the bill is cache expiry.&lt;/strong&gt; The expensive moment is the first prompt after an idle hour, when the whole context is re-written. Put the cache clock where you can see it, and keep subagent work to minutes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your attention is what runs out first, so route it.&lt;/strong&gt; A push when a session is waiting, cancelled as soon as I answer, got 34 of 35 blocked sessions answered in one eighteen-hour stretch, without me cycling through panes to find them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assume sessions die.&lt;/strong&gt; Addresses go stale and a reset session forgets what it asked for, so anything that matters has to land somewhere that outlives the session: a shared inbox file, a handoff, the wiki, second-brain.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I didn't build a framework for any of this. Claude Code supplied the messaging, and I added the harness, the mods and the rules around it until nine sessions could run side by side all day without me relaying between them.&lt;/p&gt;

</description>
      <category>aiagents</category>
      <category>claudecode</category>
      <category>developertools</category>
      <category>workflow</category>
    </item>
    <item>
      <title>Open Jev research: a month of chasing coverage at 5% error</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Mon, 12 Oct 2026 10:03:52 +0000</pubDate>
      <link>https://dev.to/anyesh/open-jev-research-a-month-of-chasing-coverage-at-5-error-4bid</link>
      <guid>https://dev.to/anyesh/open-jev-research-a-month-of-chasing-coverage-at-5-error-4bid</guid>
      <description>&lt;p&gt;TypeSafe AI put &lt;a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" rel="noopener noreferrer"&gt;Jev&lt;/a&gt; into limited early access on 15 September 2026. It is a closed "System One" model: you send it a state and a list of typed questions, and it returns a probability for every option instead of generating text. The open clones already matched its accuracy, but Kev's README reports that the best of them, Kev-9B, can answer only 0.45 to 0.57 of decisions automatically at a 5% error rate, against 0.70 for Jev. Between 23 September and 12 October I worked on that gap with open models and a single 16 GB RTX 4070 Ti Super, and when the answer for my own use turned out to be "use the models that already exist", I asked whether decisions of that quality could run on a CPU.&lt;/p&gt;

&lt;p&gt;None of the models I built beat the released ones on the metric the series is about. On the same 1,046-question general set, every 4B to 9B model I scored lands between 0.550 and 0.557 coverage at 5% error: Kev-4B, decider-4b, Cloudflare's Clef-flash, and my llama.cpp port of Kev-4B. Every attempt to get a smaller model there (a raw MoE screen, Kev's training recipe on Granite-H-350M, distilling Kev-4B into Kev-0.8B) finished at or below Kev-0.8B's 0.276. Along the way I built a decision router that serves these models to my agent harness, an adversarial panel for shell-command risk, and three small public models that you can try side by side in a &lt;a href="https://huggingface.co/spaces/anish-shrestha/small-decision-models" rel="noopener noreferrer"&gt;demo Space&lt;/a&gt;. This post is the hub for the series: what Jev is, the one metric every post uses, how the month went, and a map of the results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jev and its open copies
&lt;/h2&gt;

&lt;p&gt;Jev exposes one endpoint, &lt;code&gt;POST /v1/systemone&lt;/code&gt;, which takes a &lt;code&gt;state&lt;/code&gt; (text or JSON) and a list of &lt;code&gt;questions&lt;/code&gt;. There are three question types: Choice picks one of up to 255 options and returns per-option probabilities, Score rates against ordered levels, and Noul returns a yes/no probability. TypeSafe says the model is a transformer trained only on synthetic data and post-trained with "Reinforcement Learning for Calibrated Decisions", and it has published no paper, weights or parameter count. Its headline figures (193.6 times faster, 444.6 times cheaper) come from TypeSafe's own workflow evals against the average of two frontier LLMs, while independent tests found about 2.9 times the speed and 12 times lower cost. Archer Hume's &lt;a href="https://archerhume.com/posts/jevs-architecture-unmasked/" rel="noopener noreferrer"&gt;black-box probing&lt;/a&gt; suggests the likeliest design: encode the shared state once, run each question as its own branch over that prefix, and read the answer straight off the option logits.&lt;/p&gt;

&lt;p&gt;Two open projects speak the same API. &lt;a href="https://huggingface.co/jaredpalmer/kev-4b" rel="noopener noreferrer"&gt;Kev&lt;/a&gt;, by Jared Palmer, ships at 0.5B, 0.8B, 4B and 9B, and &lt;a href="https://github.com/NandhaKishorM/laya" rel="noopener noreferrer"&gt;Laya&lt;/a&gt;, mostly written by Nandakishor of Convai Innovations (Apache-2.0), ships a server that speaks Jev's wire format. Two more arrived during the month: decider-4b (Mapika, Apache-2.0) and Cloudflare's Clef-flash (9B, post-trained from Qwen3.5-9B, Apache-2.0, released 1 October). &lt;a href="https://anyesh.me/writing/open-jev-landscape" rel="noopener noreferrer"&gt;The landscape post&lt;/a&gt; covers how these differ.&lt;/p&gt;

&lt;h2&gt;
  
  
  The metric: coverage at 5% error
&lt;/h2&gt;

&lt;p&gt;A decision model is useful in an automated pipeline only if you can trust the answers it is sure of and send the rest to something slower. That is selective prediction: the model answers when it is confident and abstains otherwise. Coverage at 5% error measures how much it can answer under that rule.&lt;/p&gt;

&lt;p&gt;For one task, take every question, read the model's confidence as the probability of its top option, and sort the questions from most to least confident. Accept answers from the top of the list. Coverage is the largest fraction of the task you can accept while the error rate among the accepted answers stays at or under 5%. A task where the 60 most confident of 100 answers contain three mistakes covers at least 0.60. Questions with the same confidence are accepted or rejected together, and a question the model failed to answer is never accepted but still counts in the total. This is &lt;code&gt;coverage_at_error&lt;/code&gt; in Kev's &lt;code&gt;kev/metrics.py&lt;/code&gt;, which forge's scorer reuses per task. The series reports the macro figure: coverage computed per task, then averaged over tasks with equal weight.&lt;/p&gt;

&lt;p&gt;The metric rewards how well confidence is ordered, and that often disagrees with accuracy. Laya is more accurate than Kev-4B on the emotion task (0.613 against 0.550) yet covers nothing there, because its most confident answers are wrong. A raw Qwen3-4B-Instruct readout answered 72% of the general set correctly and covered 0.091, because its confidence does not separate right answers from wrong ones.&lt;/p&gt;

&lt;p&gt;Most numbers in the series come from one instrument, the general set: the development split of Kev's transfer-v9 evaluation, 1,046 questions over 11 tasks that mix public benchmarks (mmlu, sciq, qnli, emotion, paws) with probes for buried evidence, rule composition and unknowable questions. The bar for the month was about 0.55, where Kev-4B (0.555) and Clef-flash (0.550) sit.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the month went
&lt;/h2&gt;

&lt;p&gt;The first four days, 23 to 26 September, went into building my own system. After surveying the open clones I chose to build forge, a synthetic decision-data engine and coverage-first evaluation, with Kev's trainer as the first training backend. forge reproduced Kev's trainer bit for bit, a leakage audit caught the engine giving answers away through look-alike sentences, and a pilot on long buried documents was registered at about 40 GPU-hours.&lt;/p&gt;

&lt;p&gt;From 27 September the work turned toward real decisions. Loom, my agent harness, asked whether a decision model could take calls like command risk and routing off its LLM. That became verdict, a service that answers Loom over the System One API. On 1 October an experiment called K1 found that sending each task to whichever backend covers it best would gain only 1.2 points of coverage over Kev-4B alone, against a 5-point bar, and since a pipeline keeps long context in the LLM and asks the decision model short questions, the long-document pilot was solving a problem nobody had. forge was parked, and Kev and Laya became the models.&lt;/p&gt;

&lt;p&gt;On 2 and 3 October I built a command-risk panel from public security datasets, checked a public leaderboard's ranking against my own panel, and turned verdict into a router once Clef-flash came out.&lt;/p&gt;

&lt;p&gt;On 5 October the goal changed to decisions near Clef-flash quality on a CPU ladder, from a Raspberry Pi 5 with 8 GB up to a laptop x86 CPU. A single-pass decision is a prefill, which is compute-bound, so its cost tracks active parameters times tokens and offloading or streaming weights does not make it faster. I screened small bases, trained Kev's recipe on one, distilled Kev-4B into Kev-0.8B, published the three resulting models, and ported Kev to llama.cpp.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results map
&lt;/h2&gt;

&lt;p&gt;The posts go up one at a time, so titles without a link are not out yet.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Post&lt;/th&gt;
&lt;th&gt;Headline result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;&lt;a href="https://anyesh.me/writing/open-jev-landscape" rel="noopener noreferrer"&gt;The open Jev landscape&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;JevBench ranks Kev-4B 37th, but on our panel decider-4b only ties it (0.556 against 0.555 coverage)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;forge, a synthetic decision-data engine&lt;/td&gt;
&lt;td&gt;Replays Kev's trainer bit for bit (all 314 loss windows and 392 adapter tensors identical); K1's +1.2 pp against a 5 pp bar parked it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;The command_risk panel and its source leak&lt;/td&gt;
&lt;td&gt;A character n-gram logistic regression scores 0.965 AUROC, against 0.798 for Clef-flash and 0.776 for Kev&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;verdict, a decision router&lt;/td&gt;
&lt;td&gt;Clef-flash ties Kev-4B on false alarms at full risky recall (60.5% against 61.8% on test) and now heads every chain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Small decision models on a CPU ladder&lt;/td&gt;
&lt;td&gt;Kev's recipe on Granite-H-350M reaches 0.132 coverage against Kev-0.8B's 0.276&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Distillation buys accuracy, not coverage&lt;/td&gt;
&lt;td&gt;Soft targets add 2.4 pp accuracy over gold labels; coverage stays at 0.250 against a 0.33 kill line&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Kev on llama.cpp&lt;/td&gt;
&lt;td&gt;Kev-4B at Q8 covers 0.557 against 0.555 in torch, at about 4.5 GB instead of 18 GB, with no speed gain&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm6mdp805lxif7skntsxy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm6mdp805lxif7skntsxy.png" alt="Bar chart of macro coverage at 5% error on the 1,046-question general set: Kev-4B 0.555, its llama.cpp Q8 port 0.557, decider-4b 0.556 and Clef-flash 0.550 form a plateau, while Kev-0.8B 0.276, its gold and distilled deltas 0.256 and 0.250, raw Granite-H-Tiny 0.246, Laya 0.158 and Granite-H-350M with Kev's recipe 0.132 all sit at or below half of it" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The chart puts every general-set number from the series on one axis. The 4B to 9B models are within 0.007 of each other however they were trained or served, and below 1B nothing I tried, whether a different base, more teacher-labelled data or Kev's full recipe, moved coverage above the released Kev-0.8B. The distillation result explains part of that: the teacher's probabilities carried answer knowledge but not a better ordering of confidence, and ordering is what this metric measures.&lt;/p&gt;

&lt;p&gt;Jev's 0.70 was reported on Kev's benchmark, not on the general set, so none of these posts measures the gap to Jev directly. What the month did establish is that the open 4B to 9B models agree at about 0.55, and that getting a sub-1B model near that number is a confidence-ranking problem the methods I tried did not solve.&lt;/p&gt;

</description>
      <category>jev</category>
      <category>systemone</category>
      <category>calibration</category>
      <category>selectiveprediction</category>
    </item>
    <item>
      <title>The open Jev clones: three ways to read a decision, and a leaderboard that does not transfer</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Mon, 12 Oct 2026 10:03:50 +0000</pubDate>
      <link>https://dev.to/anyesh/the-open-jev-clones-three-ways-to-read-a-decision-and-a-leaderboard-that-does-not-transfer-4aea</link>
      <guid>https://dev.to/anyesh/the-open-jev-clones-three-ways-to-read-a-decision-and-a-leaderboard-that-does-not-transfer-4aea</guid>
      <description>&lt;p&gt;Within a week of TypeSafe AI opening early access to &lt;a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" rel="noopener noreferrer"&gt;Jev&lt;/a&gt;, its closed "System One" decision model, GitHub was full of open look-alikes, and by October an independent board, JevBench, was ranking more than a hundred systems on sealed items. I needed one of these models to answer decisions for Loom, my agent harness, so the question for this post is practical: which open clone should sit behind that endpoint, and can I trust the public ranking to tell me?&lt;/p&gt;

&lt;p&gt;The clones split into three mechanism families, and the two I studied most closely, Kev and Laya, sit in different ones. JevBench ranks Kev-4B 37th with a score of 39.9, behind decider-4b at 55.8 and behind a stock Qwen3-4B-Instruct read at its option logits at 54.1. When I scored those models on my own panel, by coverage at 5% error (the share of questions a model can answer on its own while keeping its error on those under 5%; defined in &lt;a href="https://anyesh.me/writing/open-jev-research-overview" rel="noopener noreferrer"&gt;the series overview&lt;/a&gt;), decider-4b tied Kev-4B at 0.556 against 0.555, and the stock Qwen readout covered 0.091. The ranking did not transfer, and Kev-4B stayed the pinned model.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the clones are copying
&lt;/h2&gt;

&lt;p&gt;Jev takes a &lt;code&gt;state&lt;/code&gt; (text or JSON) and a list of typed questions, and returns probabilities instead of text. A &lt;strong&gt;Choice&lt;/strong&gt; question picks one of up to 255 options and returns a probability per option, a &lt;strong&gt;Score&lt;/strong&gt; question rates against ordered levels, and a &lt;strong&gt;Noul&lt;/strong&gt; returns a yes/no probability. TypeSafe says it is a transformer trained on synthetic data and post-trained with "Reinforcement Learning for Calibrated Decisions" (RLCD); there is no paper, no weights and no parameter count.&lt;/p&gt;

&lt;p&gt;The most useful public guess comes from Archer Hume's &lt;a href="https://archerhume.com/posts/jevs-architecture-unmasked/" rel="noopener noreferrer"&gt;black-box probing&lt;/a&gt; of roughly 10,000 API calls. Latency tracks input tokens rather than option count, and content injected into one question does not leak into another, which fits a causal transformer that encodes the state once and runs each question as an isolated branch over that shared prefix (the pattern from Hydragen and DeFT), ending in a softmax over option logits with no text generated. A minority view (djev) holds that Jev is a diffusion model; Hume argues diffusion is not needed to explain what the API does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways to read a decision
&lt;/h2&gt;

&lt;p&gt;Every open clone has to answer the same two questions: what hidden state does the decision head read, and how does that become a distribution over options? The answers fall into three families.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pointer head on a causal LLM&lt;/strong&gt; (&lt;a href="https://github.com/jaredpalmer/kev" rel="noopener noreferrer"&gt;Kev&lt;/a&gt; by Jared Palmer, and TinyJev). Kev packs one sequence per request: &lt;code&gt;&amp;lt;state&amp;gt; ... &amp;lt;q&amp;gt; instruction &amp;lt;opt&amp;gt; option1 &amp;lt;/opt&amp;gt; &amp;lt;opt&amp;gt; option2 &amp;lt;/opt&amp;gt; ... &amp;lt;decide&amp;gt;&lt;/code&gt;, with one &lt;code&gt;&amp;lt;q&amp;gt; ... &amp;lt;decide&amp;gt;&lt;/code&gt; block per question. The delimiters reuse rarely used Qwen special tokens, so no embeddings are resized. A block-causal mask lets each question's tokens attend to the state and to their own question block only, and position ids restart after the state for every question, so questions share the state but cannot read each other. The head has no vocabulary readout at all: two linear projections map the &lt;code&gt;&amp;lt;decide&amp;gt;&lt;/code&gt; hidden state and each option's &lt;code&gt;&amp;lt;/opt&amp;gt;&lt;/code&gt; hidden state into a 256-dimensional space, the scaled dot products become one logit per option, and a softmax over options gives the distribution. The base (Qwen3.5 at 0.8B, 4B or 9B) is frozen with a rank-16 LoRA adapter. Qwen3.5 interleaves Gated DeltaNet layers, which are recurrent and cannot honor a block mask, so on those bases each question runs as its own causal row continuing a cached state prefix, and a cache miss costs one forward pass instead of one per question. Calibration is a single post-hoc temperature per checkpoint (2.41 for the Kev-4B I pin).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mask-marker encoder&lt;/strong&gt; (&lt;a href="https://github.com/NandhaKishorM/laya" rel="noopener noreferrer"&gt;Laya&lt;/a&gt; by Nandakishor Mukkunnoth of Convai Innovations). Laya is an encoder, ModernBERT-large at 421M parameters. Each question becomes one sequence, &lt;code&gt;[CLS] &amp;lt;qtype&amp;gt; instructions [SEP] [MASK] opt0 [MASK] opt1 ... [SEP] state [SEP]&lt;/code&gt;, with a &lt;code&gt;[MASK]&lt;/code&gt; token inserted before every option. A two-layer transformer head runs over the encoder output, and a small shared scorer turns the hidden state at each &lt;code&gt;[MASK]&lt;/code&gt; position into one logit per option; a softmax over those, with a temperature per question type and option-count bucket, gives the probabilities. All of a request's questions are padded into one batch and answered in one call. Because every option has to fit in a fixed token budget, the option count is capped: on Banking77's 77 labels each option gets about 3 to 4 tokens. Training uses a strictly proper scoring rule (log score plus spherical score, plus a ranked probability term for ordinal questions) as a policy-gradient reward, which Laya's documentation calls RLCD.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First-token logit readout&lt;/strong&gt; (&lt;a href="https://github.com/TheoLeeCJ/SemIf" rel="noopener noreferrer"&gt;SemIf&lt;/a&gt;, formerly OpenJev, and &lt;a href="https://github.com/kikoncuo/jevfire" rel="noopener noreferrer"&gt;jevfire&lt;/a&gt;). These need no training. The options are written as single tokens (letters A, B, C and so on), a stock LLM runs one forward pass, and the decision is a softmax over the logits of those candidate tokens at the first answer position, the same trick as FIRST (&lt;a href="https://arxiv.org/abs/2406.15657" rel="noopener noreferrer"&gt;arXiv 2406.15657&lt;/a&gt;) for listwise reranking. jevfire adds shared-prefix KV in vLLM so many questions over one state stay cheap. Two failure modes recur: ambiguous single-letter tokens (space-prefixed against byte-level) can silently corrupt the readout, and letter-slot variants run out of single tokens at about 26 to 52 options.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kev and Laya on their own numbers
&lt;/h2&gt;

&lt;p&gt;On sources it never trained on, Kev-9B reaches 0.852 test accuracy against Jev's 0.857 on the development split, a comparison Kev's own README flags as uncontrolled. The gap that remains is coverage at 5% error: Kev covers 0.45 to 0.57 against Jev's 0.70. Kev's author tried to close it during training (label smoothing, Brier and focal losses), and that round came back negative under its pre-registered gate.&lt;/p&gt;

&lt;p&gt;Laya reports beating Jev on its own benchmark (typed-decisions accuracy 0.766 against 0.727, ECE 0.081 against 0.246), but every Jev number in those comparisons is a published third-party figure, so each one is cross-study. One independent test put Laya at 0.590 against Jev's 0.974, the lowest accuracy of the clones it compared and the fastest at about 30 ms. Laya's documentation is open about its own losses: Banking77 at 0.425 to 0.492 against Jev's 0.870, and an English checkpoint that scores 0.000 on Khmer at 0.952 mean confidence.&lt;/p&gt;

&lt;h2&gt;
  
  
  What JevBench says
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://benchmarkheaven.com/api/jevbench/v1.5.4" rel="noopener noreferrer"&gt;JevBench v1.5.4&lt;/a&gt; is the one board that runs many clones on the same items: 106 ranked systems, 1,624 items of which 720 are sealed, on evaluator-owned GPUs. "Intelligence" is a chance-adjusted accuracy, and the composite rank also weights speed and cost.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rank&lt;/th&gt;
&lt;th&gt;System&lt;/th&gt;
&lt;th&gt;Base&lt;/th&gt;
&lt;th&gt;Intelligence&lt;/th&gt;
&lt;th&gt;Choice ECE&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Cygnet&lt;/td&gt;
&lt;td&gt;frozen Gemma-4-12B-it, one-token readout&lt;/td&gt;
&lt;td&gt;71.1&lt;/td&gt;
&lt;td&gt;0.041&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;Winnow-12B&lt;/td&gt;
&lt;td&gt;Gemma-4-12B-it LoRA&lt;/td&gt;
&lt;td&gt;74.4&lt;/td&gt;
&lt;td&gt;0.085&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;Jev 1.13.0&lt;/td&gt;
&lt;td&gt;closed&lt;/td&gt;
&lt;td&gt;72.0&lt;/td&gt;
&lt;td&gt;0.027&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;decider-4b v2&lt;/td&gt;
&lt;td&gt;Qwen3.5-4B-Base&lt;/td&gt;
&lt;td&gt;55.8&lt;/td&gt;
&lt;td&gt;0.049&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;21&lt;/td&gt;
&lt;td&gt;raw Qwen3-4B-Instruct-2507&lt;/td&gt;
&lt;td&gt;stock, option logits&lt;/td&gt;
&lt;td&gt;54.1&lt;/td&gt;
&lt;td&gt;0.329&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;37&lt;/td&gt;
&lt;td&gt;Kev-4B&lt;/td&gt;
&lt;td&gt;LoRA + pointer head&lt;/td&gt;
&lt;td&gt;39.9&lt;/td&gt;
&lt;td&gt;0.278&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;93&lt;/td&gt;
&lt;td&gt;Laya&lt;/td&gt;
&lt;td&gt;ModernBERT-large&lt;/td&gt;
&lt;td&gt;0.0&lt;/td&gt;
&lt;td&gt;0.149&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The top open system is a first-token readout on a frozen 12B model, and a 4B model read the same way with no training at all beats Kev-4B by 14 points, which on the board's face meant I was serving the wrong model.&lt;/p&gt;

&lt;p&gt;Provenance narrowed the candidates before any measurement. Nimble's pipeline contains a bridge that calls the Jev API although its README says it was not distilled from Jev, JevK5 is reported to include GPT outputs, and several "jev-distill" models train on Jev outputs. &lt;a href="https://huggingface.co/Mapika/decider-4b" rel="noopener noreferrer"&gt;decider-4b&lt;/a&gt; (by Mapika, Apache-2.0) states a local Qwen3.5-27B teacher and nothing distilled from Jev, which made it the best-placed 4B candidate. The raw Qwen readout was the training-free control.&lt;/p&gt;

&lt;h2&gt;
  
  
  K2: scoring the board's picks on my panel
&lt;/h2&gt;

&lt;p&gt;The board's task mix is not Loom's: Loom asks short questions, and it needs a model that knows when not to answer more than one that answers most things right. The board's Kev row also describes a Qwen3-4B base, while I pin &lt;a href="https://huggingface.co/jaredpalmer/kev-4b" rel="noopener noreferrer"&gt;&lt;code&gt;jaredpalmer/kev-4b&lt;/code&gt;&lt;/a&gt; at revision &lt;code&gt;139fdd9&lt;/code&gt;, so I could not tell whether it was the same model. I pre-registered a check, K2, before running anything: score decider-4b and the raw Qwen readout on the same panel Kev-4B had already been scored on, and swap only if a candidate beats Kev-4B by at least 5 points of macro coverage at 5% error with a bootstrap lower bound above zero, on both the full panel and the panel without emotion and sciq (decider's training mixture touches those two).&lt;/p&gt;

&lt;p&gt;The panel is the development split of Kev's frozen transfer-v9 eval suite: 11 tasks and 1,046 questions. Both new arms ran on my GPU box (a 16 GB RTX 4070 Ti Super) through decider's own server, the raw Qwen arm through its chat readout layout with no temperature, so that arm measures the stock model plus decider's prompt and readout. The Kev-4B and Laya rows are reused from the earlier K1 run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fac3m7ohoye1scwx93bfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fac3m7ohoye1scwx93bfb.png" alt="Two bar charts side by side for the same four models. On JevBench intelligence, decider-4b scores 55.8, raw Qwen3-4B 54.1, Kev-4B 39.9 and Laya 0.0. On coverage at 5% error on my 11-task panel, decider-4b scores 0.556, raw Qwen3-4B 0.091, Kev-4B 0.555 and Laya 0.158" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Arm&lt;/th&gt;
&lt;th&gt;11-task macro&lt;/th&gt;
&lt;th&gt;Difference from Kev-4B (lower bound)&lt;/th&gt;
&lt;th&gt;9-task macro&lt;/th&gt;
&lt;th&gt;Difference (lower bound)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Kev-4B&lt;/td&gt;
&lt;td&gt;0.555&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;0.549&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;decider-4b&lt;/td&gt;
&lt;td&gt;0.556&lt;/td&gt;
&lt;td&gt;+0.1 pp (-9.1)&lt;/td&gt;
&lt;td&gt;0.518&lt;/td&gt;
&lt;td&gt;-3.2 pp (-13.2)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;raw Qwen3-4B&lt;/td&gt;
&lt;td&gt;0.091&lt;/td&gt;
&lt;td&gt;-46.4 pp (-54.7)&lt;/td&gt;
&lt;td&gt;0.000&lt;/td&gt;
&lt;td&gt;-54.9 pp (-64.7)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Laya&lt;/td&gt;
&lt;td&gt;0.158&lt;/td&gt;
&lt;td&gt;-39.7 pp (-46.6)&lt;/td&gt;
&lt;td&gt;0.131&lt;/td&gt;
&lt;td&gt;-41.8 pp (-50.5)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Nothing came close to the swap rule, so Kev-4B stayed.&lt;/p&gt;

&lt;p&gt;The raw Qwen readout answers 72% of the panel correctly and still covers only 0.091, because at temperature 1.0 its confidence does not separate right answers from wrong ones. No threshold keeps its error under 5% on any task except sciq, where every arm covers 1.000. JevBench's 54.1 rewards accuracy, while my swap rule rewards knowing when to answer.&lt;/p&gt;

&lt;p&gt;decider-4b and Kev-4B tie on the macro with opposite strengths:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Kev-4B coverage&lt;/th&gt;
&lt;th&gt;decider-4b coverage&lt;/th&gt;
&lt;th&gt;Kev-4B accuracy&lt;/th&gt;
&lt;th&gt;decider-4b accuracy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;unknowable_control&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;0.691&lt;/td&gt;
&lt;td&gt;0.955&lt;/td&gt;
&lt;td&gt;0.827&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;composition_holdout&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;0.750&lt;/td&gt;
&lt;td&gt;0.979&lt;/td&gt;
&lt;td&gt;0.896&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;buried&lt;/td&gt;
&lt;td&gt;0.375&lt;/td&gt;
&lt;td&gt;0.075&lt;/td&gt;
&lt;td&gt;0.700&lt;/td&gt;
&lt;td&gt;0.675&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;legacy_holdout&lt;/td&gt;
&lt;td&gt;0.800&lt;/td&gt;
&lt;td&gt;0.662&lt;/td&gt;
&lt;td&gt;0.812&lt;/td&gt;
&lt;td&gt;0.738&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;paws&lt;/td&gt;
&lt;td&gt;0.275&lt;/td&gt;
&lt;td&gt;0.188&lt;/td&gt;
&lt;td&gt;0.787&lt;/td&gt;
&lt;td&gt;0.713&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;qnli&lt;/td&gt;
&lt;td&gt;0.825&lt;/td&gt;
&lt;td&gt;0.925&lt;/td&gt;
&lt;td&gt;0.912&lt;/td&gt;
&lt;td&gt;0.925&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mmlu&lt;/td&gt;
&lt;td&gt;0.350&lt;/td&gt;
&lt;td&gt;0.575&lt;/td&gt;
&lt;td&gt;0.725&lt;/td&gt;
&lt;td&gt;0.725&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;tweet_offensive&lt;/td&gt;
&lt;td&gt;0.312&lt;/td&gt;
&lt;td&gt;0.588&lt;/td&gt;
&lt;td&gt;0.738&lt;/td&gt;
&lt;td&gt;0.787&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;emotion&lt;/td&gt;
&lt;td&gt;0.163&lt;/td&gt;
&lt;td&gt;0.463&lt;/td&gt;
&lt;td&gt;0.550&lt;/td&gt;
&lt;td&gt;0.762&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;mmlu_pro&lt;/td&gt;
&lt;td&gt;0.005&lt;/td&gt;
&lt;td&gt;0.205&lt;/td&gt;
&lt;td&gt;0.560&lt;/td&gt;
&lt;td&gt;0.505&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;sciq&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;1.000&lt;/td&gt;
&lt;td&gt;0.975&lt;/td&gt;
&lt;td&gt;0.988&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;decider-4b is better on knowledge and classification tasks (mmlu, mmlu_pro, qnli, tweet_offensive, and emotion, which its training mixture may have seen). Kev-4B is better on buried evidence, held-out rule compositions and above all unknowable_control, the questions where the deciding evidence was removed and answering is the error. That is the task that matters most to Loom, and Kev-4B covers 1.000 of it against decider-4b's 0.691. decider-4b answered at 48 ms p50 against Kev-4B's 553 ms, but the two ran on different serving stacks, so that gap mixes model and server.&lt;/p&gt;

&lt;p&gt;Running decider took three fixes on the GPU box: its server needs &lt;code&gt;flash-linear-attention&lt;/code&gt; and &lt;code&gt;causal-conv1d&lt;/code&gt;, so it ran in WSL; its CUDA-graph warm-up did not fit 16 GB, so it ran eager; and the WSL image could not live on a nearly full system drive, because filling it corrupted the distro once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this leaves the pick
&lt;/h2&gt;

&lt;p&gt;The readout family decides what the head reads (option tokens in the vocabulary, a pointer between two hidden states, or a marker in a bidirectional encoder) and with it the option cap and the cost per question. The top open system on JevBench is a first-token readout, yet on my panel a training-free first-token readout covered 0.091 because its confidence could not tell right from wrong. For a caller that has to abstain, what matters is whether the model's confidence orders right answers above wrong ones, and JevBench's intelligence axis does not measure that. A per-task mix of Kev-4B and decider-4b looks tempting given the opposite strengths, but the earlier K1 run found only +1.2 points of oracle headroom for per-task selection with Laya as the second model, and this panel was not built to choose between models, so any follow-up needs fresh items. K2 kept Kev-4B as the pinned model in verdict, the decision service Loom calls.&lt;/p&gt;

</description>
      <category>jev</category>
      <category>kev</category>
      <category>laya</category>
      <category>calibration</category>
    </item>
    <item>
      <title>My coding agents keep a record of what they decided and why, not just what they built</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Sat, 29 Aug 2026 21:55:14 +0000</pubDate>
      <link>https://dev.to/anyesh/my-coding-agents-keep-a-record-of-what-they-decided-and-why-not-just-what-they-built-igk</link>
      <guid>https://dev.to/anyesh/my-coding-agents-keep-a-record-of-what-they-decided-and-why-not-just-what-they-built-igk</guid>
      <description>&lt;p&gt;A session with a coding agent ends and whatever it figured out along the way goes with it. The code survives, since it's on disk. The reasoning behind the code doesn't: why this table got a composite index instead of two separate ones, why the retry logic gave up after three attempts instead of five, which approach got tried first and thrown out. Open a new session next week on the same project and the agent starts from the code alone, with no memory of any of that.&lt;/p&gt;

&lt;p&gt;Claude Code has a memory system for this, and it's genuinely good at what it does. Cursor has nothing like it. I run the two on different machines for different kinds of work, Claude Code where I vibecode, Cursor on a separate box for the work I want to sit with, so it was never a question of getting one tool's session context into the other's. What I wanted was a record of the reasoning that outlives any single machine: an Obsidian vault, synced with the self-hosted &lt;code&gt;obsidian-livesync&lt;/code&gt; plugin, that both machines write into and that also lands on my phone for a quick read when I'm nowhere near either one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The code always survives a session. The reasoning behind it only does if something writes it down, and by default nothing does.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A session's reasoning normally dies with the session, leaving only the code on disk. A wiki and devlog written during the session survive as files any future session, in either Claude Code or Cursor, can read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/wiki-devlog-agent-memory" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Three hooks doing what a prompt can't
&lt;/h2&gt;

&lt;p&gt;Telling an agent in its system prompt to "keep a devlog" doesn't work reliably. It's one more instruction competing with the task itself, and the task wins almost every time, because the task is enforced by the point of the session and the devlog instruction is enforced by nothing. What actually holds is three separate hooks in the harness, each firing at a different point in the session, backing each other up.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: SessionStart hands the agent what it already knows, and the nudge keeps repeating through the middle of the session, but the stop hook is the only one of the three that can actually hold up a session ending.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A session timeline with three enforcement points. At session start, a hook injects the recent devlog and wiki index as context. Every fifth turn, a hook checks whether any wiki file has been written yet and nags if not. At session stop, a hook counts code edits and blocks the session from ending if three or more edits happened with no devlog or index update.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/wiki-devlog-agent-memory" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first hook, &lt;code&gt;session-start-wiki.sh&lt;/code&gt;, runs when a session opens and hands the agent the last three devlog entries plus an index of every project in the wiki, so it starts already knowing what happened last time instead of re-deriving it from the code. The context it injects is one fixed block: &lt;code&gt;WIKI: project={slug} vault={wiki_vault}&lt;/code&gt;, followed by an instruction to write plans, decisions, spikes, and devlog entries as it works.&lt;/p&gt;

&lt;p&gt;The second, &lt;code&gt;wiki-nudge.sh&lt;/code&gt;, checks in every fifth turn. If no wiki file has been touched yet this session, it injects a reminder pointing at the exact devlog path to write to and the index file that has to be updated alongside it, and it repeats on the same schedule until something gets written.&lt;/p&gt;

&lt;p&gt;The third is the one that actually forces the issue. &lt;code&gt;stop-wiki-enforce.sh&lt;/code&gt; runs when the session is about to end, counts how many &lt;code&gt;Write&lt;/code&gt;, &lt;code&gt;Edit&lt;/code&gt;, or &lt;code&gt;NotebookEdit&lt;/code&gt; calls happened in the transcript, and if three or more code changes went by with no devlog or index update to match, it blocks the stop outright. In Claude Code that's a &lt;code&gt;{"decision": "block"}&lt;/code&gt; response the hook returns; in Cursor, which doesn't expose a transcript path the same way, it falls back to checking whether anything in the wiki directory changed in the last two hours. Either way the session doesn't get to close clean. The reason for it gets re-fed as the next prompt, and the agent has to either write the entry or explain why this particular session didn't need one.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The threshold sits at 3 edits so a single typo fix passes through without demanding a devlog entry for it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Decision flow for the stop hook. Session ends triggers a count of code-edit tool calls. Fewer than three edits lets the session end normally. Three or more edits checks whether a devlog or index update happened. If yes, the session ends normally. If no, the stop is blocked and the reason is fed back as the next prompt.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/wiki-devlog-agent-memory" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A fourth hook applies the same idea to a different failure mode. Long sessions get compacted to fit the context window, and anything unwritten before that happens disappears the same way it would at session end. &lt;code&gt;pre-compact.sh&lt;/code&gt; fires right before that compression runs and gives the agent one explicit last chance to write down any plans, decisions, spikes, or concepts from the session, since compaction is the point where the context actually goes away.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually gets written
&lt;/h2&gt;

&lt;p&gt;The wiki has a fixed shape: &lt;code&gt;wiki/projects/&amp;lt;slug&amp;gt;/&lt;/code&gt; holds an &lt;code&gt;overview.md&lt;/code&gt;, a &lt;code&gt;devlog.md&lt;/code&gt;, and subfolders for &lt;code&gt;decisions/&lt;/code&gt;, &lt;code&gt;plans/&lt;/code&gt;, and &lt;code&gt;spikes/&lt;/code&gt;, plus a top-level &lt;code&gt;index.md&lt;/code&gt; that lists every project. Each page type has its own template. A decision page has to name the alternatives that were on the table alongside the one that won. A spike page states the question it was answering before it gets to the finding. The devlog format is the strictest: a dated heading, two to four bullets, written as plain fact rather than a "here's what we did this session" narration, with no name attached and no hedged phrasing softening what happened. That strictness is what keeps a year of entries readable in one sitting rather than turning into the same throat-clearing paragraph with a new date stamped on it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The wiki is the part both agents share, with Claude Code's own memory running alongside it as a second, private layer Cursor has no way to reach.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Claude Code on one machine and Cursor on a separate machine both write to and read from the same Obsidian vault, kept in sync by a self-hosted plugin. Claude Code additionally maintains its own separate native memory system that Cursor has no equivalent of and cannot read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/wiki-devlog-agent-memory" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The hooks themselves are identical on both sides. &lt;code&gt;session-start-wiki.sh&lt;/code&gt;, &lt;code&gt;wiki-nudge.sh&lt;/code&gt;, and &lt;code&gt;stop-wiki-enforce.sh&lt;/code&gt; are deployed to &lt;code&gt;~/.claude/&lt;/code&gt; and &lt;code&gt;~/.cursor/&lt;/code&gt; unchanged, same triggers, same thresholds, and only the JSON shape of the block response differs because the two tools expect different formats. The harness's own docs never claim Cursor needs this more because it lacks a native memory system; that's my own read of the setup, not a documented rationale. I think it holds up anyway. Claude Code's memory already softens the cost of a missed devlog entry, where Cursor has no such fallback, so the same devlog is doing more of the actual work for Cursor sessions than for Claude Code ones.&lt;/p&gt;

&lt;p&gt;This doesn't replace what Claude Code's memory does. That system decides on its own what's worth keeping and recalls it without me asking, where the wiki only surfaces the specific file a hook decided to inject. What the wiki adds is a shared, greppable record that exists independent of either tool, readable on a phone as easily as on either machine, in a text editor, or in a completely different tool six months from now, because it's a stack of plain markdown files with a template, sitting on disk, that I could read at 2am with nothing running at all.&lt;/p&gt;

&lt;p&gt;The harness's own README states the philosophy bluntly: "The human never writes the wiki. The LLM writes and maintains all of it." That line only holds because the enforcement backs it up. Without the stop hook it would just be an aspiration; with it, a session that closes on three or more real changes has to have written the record of them first.&lt;/p&gt;

</description>
      <category>aiagents</category>
      <category>claudecode</category>
      <category>developertools</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Scheduling every job on a GPU that can only hold one model</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Sat, 29 Aug 2026 21:54:33 +0000</pubDate>
      <link>https://dev.to/anyesh/scheduling-every-job-on-a-gpu-that-can-only-hold-one-model-1n</link>
      <guid>https://dev.to/anyesh/scheduling-every-job-on-a-gpu-that-can-only-hold-one-model-1n</guid>
      <description>&lt;p&gt;A Raspberry Pi 5 runs DNS for the network, plus dozens of other small services that don't need much CPU or memory but can't go down. A Jetson Orin Nano handles anything that needs a GPU, and its GPU and CPU share one memory pool, small enough to hold one loaded model or one active render job, never both.&lt;/p&gt;

&lt;h2&gt;
  
  
  One flat network
&lt;/h2&gt;

&lt;p&gt;There's one LAN. Clients and services aren't split into VLANs or separated behind an internal firewall; the upstream router is the gateway, and everything else sits behind it as a peer. If one device gets compromised, there's nothing stopping it from reaching every other device on the LAN. I've thought about segmenting it and decided against it: at this size, a mesh of routing rules is more to maintain than the threat justifies. It stays flat.&lt;/p&gt;

&lt;p&gt;The Pi carries DNS and everything that has to be up all the time. It's picked for uptime and low draw, not speed, and I don't let it run anything that could pin its CPU long enough to take DNS down with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  One model at a time
&lt;/h2&gt;

&lt;p&gt;Load two things onto the Jetson that it can't both hold, and it thrashes. So nothing talks to it directly: every job (a chat request, a background research task, a scheduled scrape) lands in a durable queue first, and a single gateway between that queue and the Jetson admits exactly one job at a time, by priority. That gateway is most of the engineering here. Skip it and two jobs landing at once both try to load into memory built for one, and now the box is fighting itself instead of doing either job.&lt;/p&gt;

&lt;p&gt;Priority doesn't preempt. If a background scrape is already loaded and running when a chat request comes in, the chat request doesn't kill it, it queues behind it and jumps ahead of everything else waiting. The alternative, killing a running job because something more urgent showed up, throws away whatever work was already done and risks leaving the model half-loaded. Waiting for the current job to finish costs a few seconds at most; a job that has to restart from zero costs more than that most of the time.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Everything queues through one gateway before it reaches the Jetson, except the RTX box's own render work, which never goes near it.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Diagram: client devices reach a Raspberry Pi 5, which enqueues jobs through a scheduler into a single gateway that admits one job at a time to the Jetson Orin Nano. A second, separate RTX 4070 Ti Super box renders directly and bypasses the gateway, except for the one shared model call it routes through it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/homelab-reference-architecture" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A second machine, with an RTX 4070 Ti Super, does rendering, and it doesn't go through this gateway for that work. The gateway exists to arbitrate the Jetson's single model slot, and the RTX box was never competing for that slot to begin with, so routing it through anyway would just add latency it doesn't need. It does share one thing with the Jetson: a single LLM call both need. For that one call, the two machines are fighting over the same resource, so it queues like everything else.&lt;/p&gt;

&lt;h2&gt;
  
  
  The price of running it this way
&lt;/h2&gt;

&lt;p&gt;A Pi 5, a Jetson Orin Nano, and a desktop GPU: together roughly the price of a decent laptop.&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>selfhosting</category>
      <category>networkarchitecture</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>hearth is what I built to schedule every job on my homelab's GPU</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Sat, 29 Aug 2026 21:54:31 +0000</pubDate>
      <link>https://dev.to/anyesh/hearth-is-what-i-built-to-schedule-every-job-on-my-homelabs-gpu-534c</link>
      <guid>https://dev.to/anyesh/hearth-is-what-i-built-to-schedule-every-job-on-my-homelabs-gpu-534c</guid>
      <description>&lt;p&gt;Every scheduled job in my homelab runs through a platform I built called hearth, and one piece of it is a gateway that admits one job at a time to whichever machine happens to be running a model. It runs on the Pi, and it exists because nothing else that could do the job fit the hardware. Kubernetes-style orchestration (k3s, Nomad) carries its own memory tax, and the Pi was already sitting at 5 GiB used plus 4.4 GiB of swap before adding a scheduler to the pile. Plain systemd timers per service were the other option, and they don't do priority ordering, backpressure, or a shared budget across jobs, which is most of what a GPU with one model slot needs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The two numbers that guard the gateway, the duration estimate and the output cap, both live at the one point that can measure them.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Diagram: a submitted job enters a priority queue, which either parks it on a down dependency, dead-letters it after exhausted retries, or forwards it to a resource-class slice sized against an estimate that is the maximum of its last five runs. The gateway admits one job at a time to the GPU box, deriving its output cap from the request timeout times the model's measured tokens per second.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/hearth-job-scheduler-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  A queue that survives a reboot for free
&lt;/h2&gt;

&lt;p&gt;hearth's queue is SQLite in WAL mode, not Redis or Celery. Memory is the scarce resource on this box, not throughput, and a SQLite file on disk means the queue's state survives a reboot without anything extra. Jobs carry a priority (interactive, user, batch, best-effort), a manifest-driven schedule, retry with exponential backoff, and a dead-letter path for anything that needs a human to look at it. If a job depends on something that's down, it parks instead of burning retries against a dependency that isn't coming back soon.&lt;/p&gt;

&lt;p&gt;Each job runs as a subprocess inside its own &lt;code&gt;systemd-run&lt;/code&gt; scope, and every resource class maps to a systemd slice with its own memory and CPU limits. An OOM kills the one job in that slice, not the host.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: Without a slice boundary, one job's OOM takes the whole host down. With one, it's contained to the slice that job runs in.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two panels compared. Left, no resource classes: three jobs share one process space with no boundary, one job OOMs, and the whole host crashes. Right, hearth's resource classes: each job runs in its own systemd slice with its own memory cap, one job OOMs inside its own slice, and the other two jobs and the host keep running.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/hearth-job-scheduler-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Adding a resource class costs two files, not one, a manifest entry and a matching slice unit, and there's a test that fails loudly if the second file is missing. A job in a class with no slice unit doesn't error at validation, it dies five seconds into every run with no output and nothing in the journal, so the two-file rule exists to keep that failure mode rare.&lt;/p&gt;

&lt;h2&gt;
  
  
  The gateway learns durations from the worst recent run, not the typical one
&lt;/h2&gt;

&lt;p&gt;hearth's scheduler will only start a queued job ahead of a fixed time window if it can promise the job finishes before that window closes, which means it needs an honest estimate of how long the job takes. The first version learned that estimate as the median of the last five runs, on the reasoning that one bad night shouldn't poison the number.&lt;/p&gt;

&lt;p&gt;One of the jobs that runs through hearth is bimodal: about twenty minutes when it finds real work, about five seconds when it doesn't. Two of its three recorded runs were quiet ones, so the learned median came out to six seconds against a real run that took twenty-one minutes. Under that estimate, the scheduler would have started the job thirty seconds before a workday window it had no chance of clearing. Deleting the two quiet runs fixed the number for twenty minutes, until a fresh quiet run dragged it right back down, which is what proved the fix was against the symptom, not the cause: a bimodal job produces quiet runs indefinitely, and a median can't tell a normal quiet run from an anomaly.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The median estimate sits next to the two quiet runs and ignores the one real run entirely; the max estimate sits next to the real run.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Log-scale timeline of three recorded runs: two quiet runs at 5 seconds each and one real-work run at just over 20 minutes. The median estimate of 6 seconds lands next to the quiet runs and misses the long run entirely; the max estimate of 1277 seconds lands next to the long run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/hearth-job-scheduler-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The estimate is now the maximum of the last five runs, not the median. Verified against the same history: max reads 1277 seconds where median read 641. Under-promising is the dangerous direction here, since a job that starts and gets killed partway wastes the work it did before dying, while over-promising only makes something wait a little longer, which costs nothing. A job with occasional long runs is always scheduled as if it will take the long path, so fewer jobs fit into small gaps in an otherwise empty day. For a scheduler whose entire job is filling a mostly idle day, that's a fine trade. It wouldn't be on hardware that's busy.&lt;/p&gt;

&lt;h2&gt;
  
  
  The output cap moved out of every caller and into the gateway
&lt;/h2&gt;

&lt;p&gt;Every service calling into the GPU box's model used to hardcode its own token limit, and every single one of those numbers was wrong. Twenty-nine calls in one day landed on exactly 1024 tokens against prompts of 600 to 900 tokens, some of them for a job scoring zero results out of eighty-one it should have judged, because the model's answer got cut mid-word before it finished.&lt;/p&gt;

&lt;p&gt;No caller can size this correctly, because the two facts that determine a correct cap don't live where the caller lives. The context window is a property of the model config, and the generation rate is a property of the hardware, and a caller has access to neither, so any number it writes down is a guess. Guesses land low, because a low guess only fails sometimes, and it takes a while to notice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The guessed cap barely covered the prompt itself, let alone an answer. The derived cap comes from the timeout budget and the model's measured speed, the two facts only the gateway has.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Bar comparison: a typical caller-guessed cap of 1024 tokens, the prompt size itself at 969 tokens, and the gateway-derived cap of 12510 tokens shown at full width for scale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/hearth-job-scheduler-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fix moved the cap to the one place that has both facts: the gateway derives it from the request's timeout budget times the model's measured tokens per second, and fills that number in whenever a caller sends none. One of the models running through hearth is both the slowest measured, at 13.9 tokens a second against a faster model's 17.5, and the one with the largest context window, so an unbounded generation on that model alone could hold the GPU for close to an hour under a single-slot gateway. Sizing the cap to the same time budget the timeout already enforces costs the same wall clock in the worst case, but comes back with a usable partial answer instead of nothing.&lt;/p&gt;

&lt;h2&gt;
  
  
  A second GPU doesn't get routed through a chokepoint built for a different GPU
&lt;/h2&gt;

&lt;p&gt;There's a second machine on the network with its own GPU, a dedicated render box that runs its own copy of the render pipeline directly against its own REST API, not through hearth's gateway. The gateway's entire job is arbitrating time on the GPU box's single model slot, and the second box was never competing for that slot in the first place, so sending its traffic through anyway would add nothing but latency.&lt;/p&gt;

&lt;p&gt;It does share one thing with the GPU box: a short script-writing call that only the GPU box can serve, since the second box has no model of its own. That one call goes through the gateway, under its own named budget, so heavy experimentation on the render side can't starve the budget an established job already depends on. The rest of that box's work gets its own resource class rather than sharing the class built to stop the GPU box double-booking itself, because serializing a render job behind the GPU box's queue would waste GPU time on hardware that was never in contention to begin with. Reachability is checked the same way hearth checks any dependency, a live probe declared once in the job's manifest, not a guard written into the job itself.&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>selfhosting</category>
      <category>systemdesign</category>
      <category>scheduling</category>
    </item>
    <item>
      <title>I run browser automation inside a disposable VM</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Thu, 27 Aug 2026 08:00:08 +0000</pubDate>
      <link>https://dev.to/anyesh/i-run-browser-automation-inside-a-disposable-vm-2le5</link>
      <guid>https://dev.to/anyesh/i-run-browser-automation-inside-a-disposable-vm-2le5</guid>
      <description>&lt;p&gt;Automating a browser that holds real logins means running code that fetches arbitrary pages on the open internet. That code needs to be treated as something that can be compromised. That's the assumption behind every decision here.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a VM instead of a sandboxed process
&lt;/h2&gt;

&lt;p&gt;The browser automation on this network runs inside a disposable virtual machine, launched on demand and torn down after each job. The reason isn't abstract: Chromium's rendering engine assumes 4 KB memory pages, and the Pi it needed to run on uses a kernel built with 16 KB pages, so navigation hung outright on the host. The direct fix, rebuilding the Pi's kernel with 4 KB pages, broke the Pi's Ethernet and took the home network's DNS down with it. That ruled out patching the host to match the browser.&lt;/p&gt;

&lt;p&gt;Running the browser inside its own small guest, with its own kernel built the way Chromium expects, sidesteps the page-size problem entirely and never touches the host kernel, its network stack, or the DNS resolver running on that same box. The guest costs about 2 GB of memory while it's running and a few tens of seconds to boot cold, so it stays on-demand rather than always-on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Placement: the always-on box, not the one running a model
&lt;/h2&gt;

&lt;p&gt;This automation runs on the Raspberry Pi, not the GPU box. The GPU box exists to hold a model in memory, and a browser process, headless or not, competes for the same pool that model needs. The Pi already carries DNS and everything else that has to be up all the time, and a browser job launched on demand under its own memory cap costs that box far less than fighting a model for the same 8 GB would cost the other one. Same reasoning that put DNS on the low-power box in the first place: a job goes where it costs the least to be wrong about.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the VM guarantees, and what it doesn't
&lt;/h2&gt;

&lt;p&gt;A VM boundary is real protection against one specific thing: if the browser inside it gets exploited at the kernel level, the compromise is stuck inside that guest. It is not, by itself, protection against the compromised guest reaching other things on the network. The guest's outbound traffic gets network-address-translated through the host, and network address translation is a routing detail, not a security boundary, so a compromised browser inside the VM can still open a connection to anything else on the LAN unless something stops it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The VM stops the exploit from leaving the guest's kernel. A separate firewall rule, enforced on the host and keyed to the guest's own uid, is what stops the resulting network traffic from leaving the guest at all.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two guarantees, two layers: the VM boundary contains a kernel-level compromise, but a separate host-level firewall rule, keyed on the browser process's user ID, is what blocks that compromised guest from reaching other devices on the LAN.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/browser-vm-isolation-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fix is a firewall rule on the host itself, not inside the guest, keyed to the dedicated user account the guest's process runs as. It denies that uid's traffic to the local network ranges and allows everything else, loaded at boot and reasserted every time a guest starts, so it holds regardless of what happens inside the VM. Enforcing it on the host rather than trusting the guest to police itself is the whole point: a compromised guest has no way to touch a rule it was never allowed to see.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two identities, not one guest with two exits
&lt;/h2&gt;

&lt;p&gt;Some jobs need to browse anonymously; some need a real logged-in session. The obvious design puts both behind one guest with a switchable exit, direct or through a VPN tunnel. That falls apart at the browser profile: a single cookie jar that sometimes exits from the home connection and sometimes from a rotating VPN address looks exactly like the pattern session-security heuristics are built to catch, and a logged-in profile behind a hopping exit collects CAPTCHAs and forced re-logins until it locks out entirely.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: One profile alternating between a home IP and a rotating VPN exit reads as account-takeover behavior to the sites it visits. Two profiles, each with a fixed identity, never trigger that pattern.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two designs compared. Left, one guest with a switchable exit: a single shared cookie jar sometimes exits direct and sometimes through the VPN, which gets flagged as suspicious and locked out. Right, two separate guests, each with its own profile and its own fixed exit, sharing no state.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/browser-vm-isolation-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fix is two separate guests, one per exit mode, each with its own user account, its own disk profile, and its own machine identity, chosen at the start of a job rather than switched mid-run. The VPN guest's profile starts empty and stays empty on purpose: anything that needs a real login has to run in the direct guest, which is the design working as intended, not a gap in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The kill switch blocked its own tunnel
&lt;/h2&gt;

&lt;p&gt;Building the VPN path surfaced a subtler lesson worth keeping. The firewall rule meant to guarantee that guest's traffic never leaves except through the tunnel was written as: drop everything for that uid except traffic on the tunnel's own interface. It looked correct, and it passed every test against a tunnel that had never successfully connected.&lt;/p&gt;

&lt;p&gt;The moment a real tunnel came up, all of that guest's traffic stopped dead, tunnel included. WireGuard's encrypted outer packets inherit the user ID of the socket that generated the data they're carrying, so they left the host still tagged as the browser guest's own uid, on the physical network interface rather than the tunnel interface, and the same rule that was supposed to protect the tunnel killed it outright.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Figure: The fix didn't change what the browser guest can do. It gave the tunnel's own transport socket a mark the guest itself has no privilege to set, so the fix can't be forged from inside the guest it protects.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two packet paths compared. Before the fix, the tunnel's own outbound packet still carries the browser guest's user ID, so the firewall rule that blocks that user ID outside the tunnel interface blocks the tunnel's own handshake. After the fix, the tunnel's packets carry a separate firewall mark the firewall accepts ahead of that rule, so the handshake gets through while the guest's other traffic is still blocked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://anyesh.me/writing/browser-vm-isolation-design" rel="noopener noreferrer"&gt;See the animated figure on anyesh.me&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fix tags the tunnel's own outbound packets with a firewall mark that only a process with elevated network privileges can set, something the confined guest doesn't have, and lets that mark bypass the block.&lt;/p&gt;

</description>
      <category>homelab</category>
      <category>selfhosting</category>
      <category>security</category>
      <category>virtualization</category>
    </item>
    <item>
      <title>Running a 26B MoE on an 8 GB Jetson by streaming experts from SSD</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Sat, 01 Aug 2026 14:00:35 +0000</pubDate>
      <link>https://dev.to/anyesh/running-a-26b-moe-on-an-8-gb-jetson-by-streaming-experts-from-ssd-2jpf</link>
      <guid>https://dev.to/anyesh/running-a-26b-moe-on-an-8-gb-jetson-by-streaming-experts-from-ssd-2jpf</guid>
      <description>&lt;p&gt;My Jetson Orin Nano has 8 GB of unified memory. Gemma 4 26B-A4B is a 13.3 GiB download at Q4. This post is about the llama.cpp patch that lets the first thing run the second thing anyway, producing logits that are bit-for-bit identical to the standard code path, and why mixture-of-experts models make that possible when dense models never could.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fci4pqpye489dqh8qgfr1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fci4pqpye489dqh8qgfr1.gif" alt="Terminal recording of gemma4-26b explaining MoE routing on the Jetson Orin Nano: raw tegrastats GPU/RAM/power at top, a derived elapsed/token/tok-s/gpu/power line under it, and the decode scrolling below, ending on llama.cpp's timings block at 2.09 tokens per second" width="760" height="607"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea is borrowed, and worth borrowing
&lt;/h2&gt;

&lt;p&gt;Credit where it belongs: the architecture comes from &lt;a href="https://github.com/drumih/turbo-fieldfare" rel="noopener noreferrer"&gt;TurboFieldfare&lt;/a&gt;, a Swift and Metal runtime that runs Gemma 4 26B-A4B in about 2 GB of RAM on Apple Silicon. Its trick is to notice that an MoE model only touches a few experts per token. The dense weights (attention, router, shared expert) stay resident, and the routed experts, which are most of the model, live on the SSD. A small per-layer cache of expert slots is filled by parallel reads the moment the router announces which experts the next token needs, and the reads hide behind compute the GPU was doing anyway. The related academic thread is Eliseev and Mazur's expert-offloading work (&lt;a href="https://arxiv.org/abs/2312.17238" rel="noopener noreferrer"&gt;arXiv:2312.17238&lt;/a&gt;), which established that MoE routing is stable enough between tokens for caching to pay off.&lt;/p&gt;

&lt;p&gt;TurboFieldfare proves the idea beautifully, but it is a bespoke runtime: two supported models, Apple platforms only, custom kernels for everything. I wanted the same idea for the other cheap 8 GB machine on my desk, a Jetson Orin Nano, and I wanted it for any MoE model I could quantize. So instead of porting the runtime, I grafted the idea into &lt;a href="https://github.com/ggml-org/llama.cpp" rel="noopener noreferrer"&gt;llama.cpp&lt;/a&gt;, which already runs on the Jetson and already has Ampere-tuned CUDA kernels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Streaming without touching a single GPU kernel
&lt;/h2&gt;

&lt;p&gt;The part I like most about the design is that no CUDA kernel changes were needed. llama.cpp evaluates the routed-expert matmul with &lt;code&gt;ggml_mul_mat_id&lt;/code&gt;, which takes the expert weight tensor plus a small tensor of selected expert ids and addresses each expert as &lt;code&gt;base + id * stride&lt;/code&gt; on the device. The kernel does not care whether &lt;code&gt;base&lt;/code&gt; points at 128 experts or at 32; it just multiplies ids by strides.&lt;/p&gt;

&lt;p&gt;So the patch allocates, per MoE layer, a persistent pool tensor holding N expert-sized slots plus a tiny slot-id tensor, and at load time it records where every expert's bytes sit in the GGUF file. During decode, a scheduler callback fires on the router's top-k node, reads the chosen expert ids, and consults a per-layer LFU cache: experts already in slots are hits, misses are &lt;code&gt;pread&lt;/code&gt; directly from the file into their assigned slots by a small thread pool. The callback writes the slot indices into the slot-id tensor and lets the graph continue. The matmul reads the pool through slot ids and gets exactly the bytes it would have read from the full tensor.&lt;/p&gt;

&lt;p&gt;There is one place to be genuinely careful, and it is the reason this patch has a paranoid test. The same expert ids feed several consumers in the graph: the main matmul, the per-expert scale vectors that quantization-aware checkpoints ship, LoRA adapters, and expert biases. Only the main matmul may see remapped slot ids. Everything else must keep the real expert ids, because those tensors stay fully resident and are indexed by actual expert number. Get this wrong and nothing crashes; the model just gets quietly stupider. The test that guards against it greedy-decodes the same prompt with streaming off and on and compares every logit of every step with &lt;code&gt;memcmp&lt;/code&gt;. Same kernels, same bytes, different addressing, therefore bitwise identity is the correct bar, not "close enough".&lt;/p&gt;

&lt;p&gt;On the Jetson there is a bonus that TurboFieldfare's mmap trick foreshadowed: the Orin's GPU shares memory with the CPU, so the slot pools live in pinned host memory that the disk reads land in directly and the GPU addresses without any copy.&lt;/p&gt;

&lt;p&gt;For the IO-hiding part, Gemma 4's graph has a shared dense FFN that runs for every token alongside the routed experts. The patch reorders the layer so the router's top-k comes first, dispatches the disk reads, lets the GPU compute the shared FFN while the NVMe works, and joins right before the expert matmul needs the data. One synchronization per layer, exactly TurboFieldfare's overlap, expressed as a graph reordering plus a two-phase callback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers from the actual machine
&lt;/h2&gt;

&lt;p&gt;Measured on a Jetson Orin Nano Super (8 GB, MAXN, NVMe) with Gemma 4 26B-A4B QAT Q4, using &lt;code&gt;llama-bench&lt;/code&gt; tg128. The baseline is the best you could previously do in llama.cpp: dense weights on the GPU, experts mmap'd on the CPU with &lt;code&gt;--cpu-moe&lt;/code&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Configuration&lt;/th&gt;
&lt;th&gt;Decode tok/s&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;--cpu-moe&lt;/code&gt; mmap baseline&lt;/td&gt;
&lt;td&gt;1.94&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Streaming, 32 slots x 8 IO threads, overlap on&lt;/td&gt;
&lt;td&gt;2.95&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same, overlap off&lt;/td&gt;
&lt;td&gt;2.23&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A few observations that the table compresses:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The overlap alone is worth 32 percent, which is the TurboFieldfare thesis confirmed on entirely different hardware: expert IO really does hide behind compute you were already doing.&lt;/li&gt;
&lt;li&gt;The NVMe's random-read ceiling (about 1.27 GB/s at this block size, per fio) puts the IO-bound limit near 5 tok/s, so there is headroom left in the IO path, not a wall.&lt;/li&gt;
&lt;li&gt;Slot count is a real tuning knob with a cliff. 32 slots per layer (a 3 GB pinned pool) is the sweet spot on 8 GB; 64 slots allocates 6 GB and starves the rest of the system.&lt;/li&gt;
&lt;li&gt;Peak RSS stays at 6.7 GB, and the correctness bar held on device: 32 greedy steps on the real 26B, every logit bitwise identical, with 10.5 GiB streamed through the pools during the comparison.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The honest tradeoff: cold prefill drops to about a quarter of the baseline's speed, because streaming mode deliberately stops pre-faulting the expert file (pre-faulting 13 GiB into 8 GB of RAM is its own disaster). Prefill-through-the-pool is the obvious next piece of work, along with O_DIRECT reads.&lt;/p&gt;

&lt;p&gt;The GIF at the top is one request against the production &lt;code&gt;gemma4-26b&lt;/code&gt; entry in llama-swap. I sent a warm-up call first to get past cold-load and cold-prefill, then recorded a streamed completion with &lt;code&gt;tegrastats&lt;/code&gt; logging GPU load and power draw as each token arrived, laid out as three regions in the same terminal so the numbers and the text are visible at once. It settled at 2.09 tok/s where the bench measured 2.95, which is about the gap I'd expect between a clean &lt;code&gt;llama-bench&lt;/code&gt; run and one live request with a different prompt. The GPU trace is the interesting part: utilization swings between 0 and 95 percent because for stretches of every layer the GPU waits while the NVMe pulls in the next expert. That is the overlap claim from earlier, on screen.&lt;/p&gt;

&lt;h2&gt;
  
  
  What generalizing bought
&lt;/h2&gt;

&lt;p&gt;Because the hook lives in llama.cpp's graph layer rather than in any model's code, it works for every GGUF MoE architecture. I verified bitwise identity on three families: Qwen3-MoE style graphs with per-expert scale tensors, Gemma 4's merged gate-up projection, and Qwen 3.5/3.6's hybrid DeltaNet layers. The same flag also gets a 22 GiB Qwen 3.6 35B-A3B onto the same 8 GB board.&lt;/p&gt;

&lt;p&gt;Is 3 tokens per second fast? No. It is roughly reading speed, fine for anything asynchronous and painful for chat. But the alternative on this hardware is not a slower 26B, it is no 26B at all. The compromise the patch offers is exactly the one I wanted: model size becomes a choice you pay for in speed instead of a hard out-of-memory wall.&lt;/p&gt;

&lt;p&gt;The work lives on the &lt;a href="https://github.com/Anyesh/llama.cpp/tree/upstream-pr/moe-stream" rel="noopener noreferrer"&gt;&lt;code&gt;moe-stream&lt;/code&gt; branch of my llama.cpp fork&lt;/a&gt;: a standalone expert streamer, a &lt;code&gt;--moe-stream&lt;/code&gt; flag, pool allocation at load, the dual-id graph integration, the Gemma 4 overlap, and the identity test harness, in seven commits against upstream master.&lt;/p&gt;

&lt;p&gt;Thanks again to TurboFieldfare for the architecture. Ideas this good deserve to escape their original hardware.&lt;/p&gt;

&lt;p&gt;The run behind that GIF is scrubbable. I put a &lt;a href="https://learn.anyesh.me/a/moe-stream-jetson-replay" rel="noopener noreferrer"&gt;replay of it on the Learning Lab&lt;/a&gt;, with GPU load and power draw lined up against each token.&lt;/p&gt;

</description>
      <category>moestream</category>
      <category>llamacpp</category>
      <category>mixtureofexperts</category>
      <category>jetsonorin</category>
    </item>
    <item>
      <title>My context selector beat grep. An agent with grep beat it.</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Fri, 31 Jul 2026 14:00:23 +0000</pubDate>
      <link>https://dev.to/anyesh/my-context-selector-beat-grep-an-agent-with-grep-beat-it-5</link>
      <guid>https://dev.to/anyesh/my-context-selector-beat-grep-an-agent-with-grep-beat-it-5</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/Anyesh/cognitive-cache" rel="noopener noreferrer"&gt;cognitive-cache&lt;/a&gt; started from an observation I still think is correct: every coding tool decides what goes into the context window, and almost none of them treat that decision as an explicit selection problem. Cursor greps, RAG systems embed and cosine-search, and plenty of harnesses just stuff files until the budget runs out. The OS analogy is hard to unsee once you have it. The context window is RAM, eviction and retrieval are virtual memory, and token budget allocation is an allocator that nobody has written.&lt;/p&gt;

&lt;p&gt;So I wrote one. Six weighted signals score every file in a repo against a task description, and a two-phase greedy submodular selector picks the highest-value set that fits a token budget. Nine languages, no LLM calls, no API keys. It shipped to PyPI and I used it through MCP for a while.&lt;/p&gt;

&lt;p&gt;Then I built a benchmark harness, and the harness spent the next two months dismantling most of what I believed about the tool. This is that sequence, in order, because the order is the interesting part.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fygvja5qkdelq2ow1nws5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fygvja5qkdelq2ow1nws5.gif" alt="Animated forest plot building row by row: cognitive-cache's recall@5 advantage over grep, with paired bootstrap 95% confidence intervals. At n=23 the interval straddles zero. At n=78 and n=91 it clears zero" width="799" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The first honest measurement said it does not beat grep
&lt;/h2&gt;

&lt;p&gt;The original benchmark was bad in the way most self-benchmarks are bad. It coupled retrieval to LLM patch generation, reported rank-blind full-set recall, had no significance test, and I almost never ran it.&lt;/p&gt;

&lt;p&gt;The replacement is LLM-free and deterministic. For each issue it clones the repo at the pre-fix commit, produces a full file ranking per strategy, and scores that ranking against the files the gold patch actually modified, using recall@k and MRR. Every head-to-head comparison carries a paired bootstrap 95% confidence interval, so a difference that excludes zero is real and a difference that straddles zero is not a result.&lt;/p&gt;

&lt;p&gt;On the first dataset, 23 hand-curated issues across 8 repos:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;strategy&lt;/th&gt;
&lt;th&gt;R@1&lt;/th&gt;
&lt;th&gt;R@5&lt;/th&gt;
&lt;th&gt;R@10&lt;/th&gt;
&lt;th&gt;MRR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;cognitive-cache&lt;/td&gt;
&lt;td&gt;0.170&lt;/td&gt;
&lt;td&gt;0.428&lt;/td&gt;
&lt;td&gt;0.511&lt;/td&gt;
&lt;td&gt;0.540&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;grep (keyword count)&lt;/td&gt;
&lt;td&gt;0.170&lt;/td&gt;
&lt;td&gt;0.409&lt;/td&gt;
&lt;td&gt;0.559&lt;/td&gt;
&lt;td&gt;0.533&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lexical (TF-IDF)&lt;/td&gt;
&lt;td&gt;0.159&lt;/td&gt;
&lt;td&gt;0.362&lt;/td&gt;
&lt;td&gt;0.496&lt;/td&gt;
&lt;td&gt;0.487&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The recall@5 difference over grep was +0.020 with a 95% CI of [-0.067, +0.109]. Grep won at &lt;a href="mailto:recall@10"&gt;recall@10&lt;/a&gt;. Whatever the tool was doing, at that sample size it was indistinguishable from counting keywords.&lt;/p&gt;

&lt;p&gt;Two other things fell out of the same run. The per-signal ablation suggested &lt;code&gt;graph_distance&lt;/code&gt;, carrying 0.20 of the weight budget, was net negative, and &lt;code&gt;file_role_prior&lt;/code&gt; was doing nothing at 0.07. And the budget selector was leaking badly: ranking recall@5 was 0.428 while end-to-end recall under a 12k budget was 0.282, so the selector was discarding relevant files its own ranking had already surfaced.&lt;/p&gt;

&lt;p&gt;I nearly acted on the ablation immediately. A weight sweep stopped me, because every candidate reweighting had a bootstrap lower bound of +0.000. The "graph_distance is net negative" reading was itself noise at n=23. The real blocker was not the weights, it was that 23 narrow issues cannot detect or drive an improvement in either direction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Widening the dataset flipped the result
&lt;/h2&gt;

&lt;p&gt;I moved to &lt;a href="https://www.swebench.com/" rel="noopener noreferrer"&gt;SWE-bench&lt;/a&gt;, which solves the curation problem by construction: real GitHub issues paired with the gold patch that fixed them, pulled over the HuggingFace datasets-server with no auth. Ground truth is the set of source files the patch modified, and because patches only touch files present at the base commit, every ground-truth file is retrievable.&lt;/p&gt;

&lt;p&gt;On a balanced 78-instance subset of SWE-bench Lite across 12 repos:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;strategy&lt;/th&gt;
&lt;th&gt;R@1&lt;/th&gt;
&lt;th&gt;R@5&lt;/th&gt;
&lt;th&gt;R@10&lt;/th&gt;
&lt;th&gt;MRR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;cognitive-cache&lt;/td&gt;
&lt;td&gt;0.231&lt;/td&gt;
&lt;td&gt;0.538&lt;/td&gt;
&lt;td&gt;0.654&lt;/td&gt;
&lt;td&gt;0.375&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;grep&lt;/td&gt;
&lt;td&gt;0.103&lt;/td&gt;
&lt;td&gt;0.359&lt;/td&gt;
&lt;td&gt;0.487&lt;/td&gt;
&lt;td&gt;0.236&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;lexical (TF-IDF)&lt;/td&gt;
&lt;td&gt;0.141&lt;/td&gt;
&lt;td&gt;0.410&lt;/td&gt;
&lt;td&gt;0.462&lt;/td&gt;
&lt;td&gt;0.253&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Recall@5 over grep: +0.179, CI [+0.064, +0.295]. Over TF-IDF: +0.128, CI [+0.013, +0.244]. Both exclude zero. On a harder 91-issue subset restricted to fixes touching two or more files, the edge held at 0.365 vs 0.252, CI [+0.056, +0.174].&lt;/p&gt;

&lt;p&gt;The earlier negative was a small-sample artifact. That cuts both ways, and it is worth sitting with: if I had published the n=23 result I would have been wrong, and if I had published the n=78 result as the final word I would also have been wrong, for the reason in the next section.&lt;/p&gt;

&lt;h2&gt;
  
  
  The baseline I had not run was an agent
&lt;/h2&gt;

&lt;p&gt;"Beats grep" means beats a naive keyword count. It says nothing about the thing my tool would actually be competing with, which is a coding agent running its own search loop.&lt;/p&gt;

&lt;p&gt;So I ran that. Five single-file SWE-bench issues, one each from flask, requests, xarray, pylint, and pytest. Fresh Claude subagents, cold in the repo at the base commit, &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;glob&lt;/code&gt;, and &lt;code&gt;read&lt;/code&gt; only, cognitive-cache explicitly forbidden.&lt;/p&gt;

&lt;p&gt;The agent got 5 of 5, averaging about 3.4 tool calls and 19k tokens, and in each case it pinpointed the mechanism rather than just the file. cognitive-cache got 4 of 5, missing pylint #5859, which the agent found in two calls. Naive keyword grep got 3 of 5.&lt;/p&gt;

&lt;p&gt;The token argument inverted at the same time. The agent read a handful of targeted files. A cognitive-cache call returns file contents up to the full token budget, so on these tasks it front-loads more context than a surgical agent consumes. It was costing context, not saving it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flijfipkigkpkhi25v5r5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flijfipkigkpkhi25v5r5.png" alt="Three stat tiles: an agent with only grep and read localized the fix file in 5 of 5 issues at about 3.4 tool calls each, cognitive-cache in 4 of 5, naive keyword grep in 3 of 5" width="799" height="353"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is n=5 on hand-picked single-file issues, so it is directional rather than definitive. But it moved the honest positioning from "more accurate than the agent" to "fewer roundtrips on a cold start in unfamiliar code", which is a much smaller claim.&lt;/p&gt;

&lt;h2&gt;
  
  
  The signal that was worth zero, and why
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;graph_distance&lt;/code&gt; measures import-graph distance from the files the task names. It carried 0.20 weight from the day I wrote it, on the reasoning that a fix often lives one hop away from the file the issue mentions.&lt;/p&gt;

&lt;p&gt;Across both datasets it earned nothing. On the 91-issue multi-file set, zeroing it changed recall@5 by +0.000 and MRR by -0.006. That was the pre-registered kill criterion, so I was ready to retire it.&lt;/p&gt;

&lt;p&gt;Then I pushed back on my own experiment, which turned out to be the useful move. Multi-file is not the same as multi-hop, a regex-based import graph is not a reference graph, and testing a signal as one term in a drowned weighted sum is not a fair test of the underlying idea. All three critiques were fair, so instead of assuming, I wrote a diagnostic over the 91-issue set to check whether the ground truth was even reachable.&lt;/p&gt;

&lt;p&gt;The answer killed the revival rather than supporting it. 93% of issues have all their ground-truth files reachable from the entry points. But &lt;strong&gt;87% of fix files are themselves entry points, at graph distance 0&lt;/strong&gt;, with only about 10% sitting at one to three hops and none further out. The mechanism was never starvation, it was redundancy: real issue text names the files it touches, so &lt;code&gt;symbol_overlap&lt;/code&gt; has already ranked those files highly and import distance adds nothing on top.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cn1xnbm8n4tlrl9y7es.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0cn1xnbm8n4tlrl9y7es.png" alt="A single bar split into three segments: 87% of ground-truth fix files sit at import-graph distance 0 from the files the issue names, 10% at one to three hops, 3% unreachable" width="799" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That is not a bug in the experiment. It is a fact about the task distribution, and it explains the agent result too. On issue-shaped work the target is usually named in the prompt, which is exactly the regime where an agentic grep loop is excellent and a static ranker has little room to add value. Claude Code shipping no code index looks less like an omission and more like the same finding, reached earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  The delivery problem, measured
&lt;/h2&gt;

&lt;p&gt;One thread survived long enough to be worth reporting separately. I built a jedi-backed neighborhood tool (definition, callers, in-repo callees, with real scope-aware resolution rather than name matching) and tested it two ways.&lt;/p&gt;

&lt;p&gt;Against agents, on two hard cross-file issues where naive grep recall was 0, I ran a 2x2: agents with grep and read, versus agents offered the neighborhood tool as well. Every arm scored 0.5, finding the file tied to the named concept and missing the cross-file one. &lt;strong&gt;The agents that had the tool invoked it zero times out of two&lt;/strong&gt;, despite being told to. Checking the tool's output directly against the symbols those same agents had reasoned about, it surfaced both missed files. The data would have lifted recall from 0.5 to 1.0 if it had been used.&lt;/p&gt;

&lt;p&gt;At scale the value is real but modest: across all 91 multi-file issues, neighborhood-of-seeds alone scores 0.164 (worse than grep's 0.252 standalone), while grep-or-neighborhood combined reaches 0.330, recovering 20 of grep's 257 missed fix files. That is +7.8 absolute points, in line with RepoGraph's own reported 9-12%.&lt;/p&gt;

&lt;p&gt;Put the two halves together and the conclusion is about delivery, not capability. A passive tool that competes with the grep reflex for invocation loses the invocation. Value like that only lands if it is injected into results the agent is already reading, not offered as one more thing it could call.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it ended
&lt;/h2&gt;

&lt;p&gt;I set &lt;code&gt;graph_distance&lt;/code&gt; to weight 0, rewrote the README around the scoreboard instead of the pitch, and stopped building. The remaining pitch would have required a forced-injection layer to capture a modest gain, in a niche that already has direct clones, running against the current of agents that search well on their own.&lt;/p&gt;

&lt;p&gt;What survives is the measurement rig: the SWE-bench importer that needs no token, the retrieval evaluator, the weight tuner, the multi-hop diagnostic, the neighbor-recovery harness, and the bootstrap CIs that make each of those trustworthy. In a category that ships on anecdotes, that is the part I would build again first.&lt;/p&gt;

&lt;p&gt;The generalizable lesson is not "context selection is a dead end". It is that the baseline you skip is the one that decides whether your work matters. I measured against grep for two months because grep was the baseline that let the tool win. The agent was two hours of work and it reframed the entire project.&lt;/p&gt;

</description>
      <category>contextengineering</category>
      <category>retrieval</category>
      <category>swebench</category>
      <category>benchmarking</category>
    </item>
    <item>
      <title>J-space in practice: using Anthropic's Jacobian lens to decide what an LLM can forget</title>
      <dc:creator>Anish Shrestha</dc:creator>
      <pubDate>Wed, 29 Jul 2026 12:07:06 +0000</pubDate>
      <link>https://dev.to/anyesh/j-space-in-practice-using-anthropics-jacobian-lens-to-decide-what-an-llm-can-forget-14h1</link>
      <guid>https://dev.to/anyesh/j-space-in-practice-using-anthropics-jacobian-lens-to-decide-what-an-llm-can-forget-14h1</guid>
      <description>&lt;p&gt;Anthropic published &lt;a href="https://transformer-circuits.pub/2026/workspace/index.html" rel="noopener noreferrer"&gt;Verbalizable Representations Form a Global Workspace in Language Models&lt;/a&gt; on July 6, and the vocabulary it introduced is suddenly everywhere: J-space, the Jacobian lens, a global workspace inside Claude. Most of the discussion so far is about interpretability and alignment auditing, which is fair, since that is what the paper is about. I had a narrower and more mercenary question: can the workspace tell an inference runtime which parts of the KV cache it is safe to throw away?&lt;/p&gt;

&lt;p&gt;Three days after the paper landed, the first pre-registered gate on that question passed. As of this week the signal has replicated on three models and ships inside &lt;a href="https://github.com/Anyesh/EVOKE" rel="noopener noreferrer"&gt;EVOKE&lt;/a&gt;, my KV cache memory manager built on a forked llama.cpp. This post covers what J-space is, why it makes a good KV cache eviction signal, the numbers across Qwen2.5-7B, Qwen3-8B, and Qwen3-4B, and the caveat that comes with them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh1hfff9leh8ua2rp18x.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frh1hfff9leh8ua2rp18x.gif" alt="Animation of the two-stage pipeline: the Jacobian lens sweeps a session's KV blocks assigning workspace scores at prefill, then under a 25% cache budget the workspace policy keeps the planted fact and answers the turn-14 probe while SnapKV evicts it and fails" width="720" height="405"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What J-space is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;The Jacobian lens is the instrument and J-space is the phenomenon. The lens isolates directions in a model's residual stream that encode a token the model could verbalize next, and those directions form a low-dimensional workspace: roughly 10% of activation variance, concentrated in the middle layers, carrying whatever the model is "holding in mind" at each position. Anthropic's headline application is alignment auditing, reading reasoning the model never voices. What makes independent work possible is that they released &lt;a href="https://github.com/anthropics/jacobian-lens" rel="noopener noreferrer"&gt;companion code&lt;/a&gt; under Apache-2.0 along with fitted lens matrices for open Qwen models on &lt;a href="https://huggingface.co/neuronpedia/jacobian-lens" rel="noopener noreferrer"&gt;Hugging Face&lt;/a&gt;, so anyone can apply the lens to an open-weights model on a single GPU.&lt;/p&gt;

&lt;h2&gt;
  
  
  The systems problem: KV cache eviction
&lt;/h2&gt;

&lt;p&gt;Every long-running LLM session eventually outgrows its KV cache budget. An agent session in a coding harness crosses tens of thousands of cached tokens within a few turns, and something has to decide which entries stay in GPU memory. The standard answers, H2O and SnapKV, rank cache blocks by accumulated attention history: keep what the model has been attending to, evict the rest. StreamingLLM adds protected sink tokens and a recency window.&lt;/p&gt;

&lt;p&gt;These policies share a structural weakness. They are backward-looking, so they can only rank blocks the model has already used. A fact planted at turn 1 that will matter at turn 14 looks cold the whole time, and it gets evicted exactly when the budget tightens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hypothesis: workspace content predicts KV reuse
&lt;/h2&gt;

&lt;p&gt;The lens readout suggested a forward-looking alternative. If a position carries workspace content, meaning the model is holding something in mind there, then its KV entries should be disproportionately likely to be read by later reasoning. That is a content signal, computable at prefill time from the residual stream alone, before any attention history exists.&lt;/p&gt;

&lt;p&gt;The offline validation lives in &lt;a href="https://github.com/Anyesh/j-space" rel="noopener noreferrer"&gt;j-space&lt;/a&gt;: lens application, a family of workspace statistics over the readout (kurtosis of block means, transport ratios, energy concentration, computed across layers), block aggregation, eviction simulation, and probe distillation. Because a signal this convenient deserved suspicion, I pre-registered three kill gates before running anything:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fact ranking.&lt;/strong&gt; The best workspace statistic has to beat SnapKV at ranking the task-critical block, by a pre-set AUC margin, or the project dies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Masked eviction.&lt;/strong&gt; With only 25% of the cache retained under the workspace policy, the planted fact has to stay answerable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Probe distillation.&lt;/strong&gt; Applying the full lens at inference time is too expensive, so a ridge probe distilled from the workspace readout has to reproduce the ranking at Spearman 0.8 or better. The deployable artifact is one dot product per position.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Results across three Qwen models
&lt;/h2&gt;

&lt;p&gt;All three gates passed on all three models, with no hand-tuning on the replications.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Fact-AUC (workspace)&lt;/th&gt;
&lt;th&gt;Fact-AUC (SnapKV)&lt;/th&gt;
&lt;th&gt;Eviction @ 25% budget&lt;/th&gt;
&lt;th&gt;Probe Spearman&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Qwen2.5-7B-Instruct&lt;/td&gt;
&lt;td&gt;0.891&lt;/td&gt;
&lt;td&gt;0.622&lt;/td&gt;
&lt;td&gt;35/36 vs 25/36&lt;/td&gt;
&lt;td&gt;0.959&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3-8B&lt;/td&gt;
&lt;td&gt;0.865&lt;/td&gt;
&lt;td&gt;0.563&lt;/td&gt;
&lt;td&gt;35/36 vs 14/36&lt;/td&gt;
&lt;td&gt;0.944&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Qwen3-4B&lt;/td&gt;
&lt;td&gt;0.939&lt;/td&gt;
&lt;td&gt;0.541&lt;/td&gt;
&lt;td&gt;36/36 vs 13/36&lt;/td&gt;
&lt;td&gt;0.946&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoeyae6nxq4pkk2aapdl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdoeyae6nxq4pkk2aapdl.png" alt="Grouped bar chart of fact-AUC on three Qwen models: the workspace signal scores 0.891, 0.865, and 0.939 while SnapKV scores 0.622, 0.563, and 0.541, barely above the 0.5 chance line" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The eviction column reads: episodes where the planted fact survived eviction and was answered correctly, workspace policy vs SnapKV at the same budget. On Qwen3-4B the workspace policy saturates at 36/36 at every budget tested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd8l6tg4fswy6q877sea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvd8l6tg4fswy6q877sea.png" alt="Grouped bar chart of eviction survival at a 25% cache budget: the workspace policy keeps the fact answerable in 35, 35, and 36 of 36 episodes while SnapKV manages 25, 14, and 13" width="800" height="465"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The distilled probe also holds up live. Inside EVOKE's agent bench, the workspace signal passes the fact probe at every cache budget (512, 1024, and 2048 tokens) with recovery disabled, while H2O fails all three budgets and SnapKV passes only at 2048. Measured decode overhead was -0.6%, which is noise; the probe is a dot product per position at prefill, and each decode step adds only a 28 KB host copy and one dot product per block.&lt;/p&gt;

&lt;h2&gt;
  
  
  What transfers and what does not
&lt;/h2&gt;

&lt;p&gt;Here is the caveat, and I think it is the most interesting finding in the project. The winning statistic is model-dependent. On Qwen2.5-7B and Qwen3-8B it is kurtosis of block-mean workspace scores at deep layers (layer 23 and layer 30 respectively). On Qwen3-4B it is a transport-ratio statistic at layer 12 of 36. If I had frozen the 7B statistic and shipped it as "the" signal, the 4B replication would have failed. What transfers is the statistic family plus the automated procedure that selects the winner per model on held-out episodes, not any single magic number.&lt;/p&gt;

&lt;p&gt;The other scope limits are stated plainly in the paper: three models so far, all Qwen; the probes are fit on the benchmark's own episode family; and the task family is long-horizon fact recall. LongBench-style suites and non-Qwen architectures are open work. As far as I can tell this is the first interpretability-derived KV eviction signal, and I would much rather over-state the limits than the result.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it ships: EVOKE v2.0
&lt;/h2&gt;

&lt;p&gt;EVOKE treats the KV cache the way an operating system treats memory. Blocks are evicted under budget pressure and recovered recompute-free through save/restore primitives added to a forked llama.cpp, 20 to 32 times faster than re-prefilling the same tokens. &lt;a href="https://github.com/Anyesh/EVOKE/releases/tag/v2.0" rel="noopener noreferrer"&gt;Version 2.0&lt;/a&gt; adds the workspace probe as a first-class eviction signal alongside live attention capture, harness priority tags, task-focus coherence, and recency, and includes the paper PDF with the full three-model evaluation.&lt;/p&gt;

&lt;p&gt;You can watch the signal work in the &lt;a href="https://huggingface.co/spaces/anish-shrestha/evoke-demo" rel="noopener noreferrer"&gt;live demo on Hugging Face Spaces&lt;/a&gt;, which runs three arms side by side on Qwen3-4B: a plain baseline, EVOKE with its attention scorer, and EVOKE with workspace eviction. There is also a benchmark walkthrough on my &lt;a href="https://anyesh.github.io" rel="noopener noreferrer"&gt;learning lab&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://transformer-circuits.pub/2026/workspace/index.html" rel="noopener noreferrer"&gt;The Anthropic paper&lt;/a&gt;, the primary source on J-space and the Jacobian lens&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/anthropics/jacobian-lens" rel="noopener noreferrer"&gt;anthropics/jacobian-lens&lt;/a&gt;, the official lens code, with fitted matrices at &lt;a href="https://huggingface.co/neuronpedia/jacobian-lens" rel="noopener noreferrer"&gt;neuronpedia/jacobian-lens&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Anyesh/j-space" rel="noopener noreferrer"&gt;j-space&lt;/a&gt;, the offline validation and probe distillation pipeline behind this post&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Anyesh/EVOKE" rel="noopener noreferrer"&gt;EVOKE&lt;/a&gt;, the runtime that consumes the signal, plus the &lt;a href="https://huggingface.co/spaces/anish-shrestha/evoke-demo" rel="noopener noreferrer"&gt;demo Space&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you work on KV cache compression, long-context inference, or interpretability and want to poke holes in any of this, the repos are public and the gates were registered before the runs. I would genuinely like to know where it breaks.&lt;/p&gt;

</description>
      <category>jspace</category>
      <category>jacobianlens</category>
      <category>interpretability</category>
      <category>kvcache</category>
    </item>
  </channel>
</rss>
