<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Level:intermediate | Bas Nijholt</title><link>https://www.nijho.lt/category/levelintermediate/</link><atom:link href="https://www.nijho.lt/category/levelintermediate/index.xml" rel="self" type="application/rss+xml"/><description>Level:intermediate</description><generator>Hugo</generator><language>en-us</language><copyright>© 2026</copyright><lastBuildDate>Mon, 19 Oct 2026 00:00:00 +0000</lastBuildDate><image><url>https://www.nijho.lt/media/icon_hu_408a8f6cef43e327.png</url><title>Level:intermediate</title><link>https://www.nijho.lt/category/levelintermediate/</link></image><item><title>Roll your own, fork the rest 🍴</title><link>https://www.nijho.lt/post/roll-your-own-fork-the-rest/</link><pubDate>Mon, 19 Oct 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/roll-your-own-fork-the-rest/</guid><description>&lt;h2 id="introduction-a-follow-up-to-something-i-wrote"&gt;Introduction: a follow-up to something I wrote &lt;a class="anchor" href="#introduction-a-follow-up-to-something-i-wrote" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In April 2025 I published &lt;a href="https://www.nijho.lt/post/dependencies/"&gt;Confessions of an asymmetric hypocrite&lt;/a&gt;, about my split personality on dependencies.&#10;Strict minimalism for the libraries I publish, and then, for applications:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;For &lt;em&gt;applications&lt;/em&gt; (especially CLIs in isolated environments), I&amp;rsquo;m far more liberal with dependencies to build features quickly.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;I also wrote that I &amp;ldquo;strongly prefer dependencies that are already widely adopted and trusted by the community&amp;rdquo; because &amp;ldquo;these are less likely to cause unexpected issues&amp;rdquo;.&lt;/p&gt;&#10;&lt;p&gt;Then I spent a year building &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom&lt;/a&gt;, which is an application, exactly the category where I said I could relax.&lt;/p&gt;&#10;&lt;p&gt;I want to report back.&#10;&amp;ldquo;Prefer &lt;span class="hover-tip" data-tooltip="Code that so many people already run in production that the common bugs have been found and fixed before you get there." tabindex="0"&gt;battle-tested&lt;/span&gt; dependencies&amp;rdquo; was the right rule.&#10;I just had the wrong idea of what battle-tested means.&#10;I thought a project with tens of thousands of GitHub stars qualified.&#10;Now I think it means &lt;strong&gt;millions of downloads, every day.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#introduction-a-follow-up-to-something-i-wrote"&gt;Introduction: a follow-up to something I wrote&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#1-stars-measure-interest-not-usage"&gt;1. Stars measure interest, not usage&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-a-popular-protocol-is-not-a-popular-library"&gt;2. A popular protocol is not a popular library&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-i-checked-the-rule-against-my-own-code"&gt;3. I checked the rule against my own code&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-roll-your-own-the-library-gives-you-the-easy-10"&gt;4. Roll your own: the library gives you the easy 10%&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-fork-your-own-when-the-problem-is-hard"&gt;5. Fork your own: when the problem is hard&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#agno-patches-instead-of-a-fork"&gt;Agno: patches instead of a fork&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-i-am-not-dunking-on-open-source-including-mine"&gt;6. I am not dunking on open source, including mine&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-my-rule-for-the-next-uv-add"&gt;7. My rule for the next &lt;code&gt;uv add&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Stars measure interest, not usage. For every dependency, ask how many projects actually run the code you are about to rely on, and how much you rely on it.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Millions of downloads a day?&lt;/strong&gt; Depend on it.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Fewer, and it only gives you the easy part?&lt;/strong&gt; Roll your own. The hard part was going to be yours anyway.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Fewer, and hard to build?&lt;/strong&gt; Fork it, and treat the fork as yours.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;If I started MindRoom over, I would write my own HTTP requests to the model providers instead of using an AI framework.&lt;/p&gt;&#10;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Update 2026-10-31:&lt;/strong&gt; In the two weeks after publishing, I took my own advice twice.&#10;MindRoom&amp;rsquo;s knowledge search no longer uses ChromaDB, and code MindRoom owns has replaced Agno&amp;rsquo;s runtime.&#10;Agno is now only MindRoom&amp;rsquo;s tool library.&#10;The full stories are in &lt;a href="#comments"&gt;the comments&lt;/a&gt;.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 id="1-stars-measure-interest-not-usage"&gt;1. Stars measure interest, not usage &lt;a class="anchor" href="#1-stars-measure-interest-not-usage" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When I picked &lt;a href="https://github.com/agno-agi/agno" target="_blank" rel="noopener"&gt;Agno&lt;/a&gt; as MindRoom&amp;rsquo;s &lt;span class="hover-tip" data-tooltip="A library that wraps the model providers&amp;#39; APIs and adds agents, tools, memory, knowledge bases and session storage on top." tabindex="0"&gt;AI framework&lt;/span&gt;, it looked like the safe choice.&#10;Today it has over 42,000 stars and 6,000 forks.&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;It also gets about &lt;strong&gt;78,000 downloads a day&lt;/strong&gt; on PyPI.&#10;&lt;a href="https://github.com/encode/httpx" target="_blank" rel="noopener"&gt;httpx&lt;/a&gt;, one of Python&amp;rsquo;s standard HTTP libraries, gets about &lt;strong&gt;25 million&lt;/strong&gt;.&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;A star is something you click once, when a README looks exciting.&#10;A download happens every time some project installs the package.&lt;/p&gt;&#10;&lt;p&gt;Most of those downloads are &lt;span class="hover-tip" data-tooltip="Continuous integration: test and build pipelines that install a fresh environment on every push, often many times a day per project." tabindex="0"&gt;CI&lt;/span&gt;, not people, so downloads are not users either.&#10;But a package with millions of downloads a day is installed by a huge number of different projects.&#10;Many of them use the same functions you are about to use, so they hit the bugs before you do.&lt;/p&gt;&#10;&lt;p&gt;Battle-tested is also not the same as old.&#10;I use &lt;a href="https://github.com/astral-sh/uv" target="_blank" rel="noopener"&gt;uv&lt;/a&gt; for everything, and it has only been around for a &lt;span class="hover-tip" data-tooltip="Astral released the first version of uv in February 2024." tabindex="0"&gt;couple of years&lt;/span&gt;.&#10;I run into bugs in uv too, but there is simply no better alternative, and it gets about 3.6 million downloads a day.&lt;/p&gt;&#10;&lt;h2 id="2-a-popular-protocol-is-not-a-popular-library"&gt;2. A popular protocol is not a popular library &lt;a class="anchor" href="#2-a-popular-protocol-is-not-a-popular-library" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The other place my old idea failed was &lt;a href="https://matrix.org" target="_blank" rel="noopener"&gt;Matrix&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Building on Matrix felt obviously correct.&#10;An open protocol, about a decade old, with serious security reviews from &lt;span class="hover-tip" data-tooltip="Governments run their own Matrix deployments, for example Tchap for the French civil service and BwMessenger for the German armed forces." tabindex="0"&gt;large organizations and governments&lt;/span&gt;.&#10;Millions of people use it.&lt;/p&gt;&#10;&lt;p&gt;Matrix is still a good protocol and I am still on it.&#10;But even though millions of people use Matrix, there are only a few client libraries.&lt;/p&gt;&#10;&lt;p&gt;MindRoom streams agent replies by editing the same message many times a second.&#10;Almost every part of the ecosystem I touched had a problem with that: &lt;span class="hover-tip" data-tooltip="The most widely used Matrix app, made by the company behind the protocol." tabindex="0"&gt;Element&lt;/span&gt;, &lt;span class="hover-tip" data-tooltip="A Matrix web client focused on a simple, Discord-like interface. MindRoom&amp;#39;s chat app is a fork of it." tabindex="0"&gt;Cinny&lt;/span&gt;, &lt;span class="hover-tip" data-tooltip="The Python Matrix client library MindRoom&amp;#39;s agents use to log in, read and send messages." tabindex="0"&gt;matrix-nio&lt;/span&gt;, and the &lt;span class="hover-tip" data-tooltip="matrix-js-sdk, the library Element Web and Cinny are built on." tabindex="0"&gt;Matrix JavaScript SDK&lt;/span&gt;.&#10;In the JavaScript SDK, edits that arrived while a thread was still loading were silently dropped, so you saw stale text until you reloaded.&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;What counts is how many projects use the library you build on.&#10;Element&amp;rsquo;s users do not test matrix-js-sdk for you. Other people building on matrix-js-sdk do.&#10;It gets roughly 100,000 downloads a day. matrix-nio, the Python client, about 23,000.&lt;/p&gt;&#10;&lt;h2 id="3-i-checked-the-rule-against-my-own-code"&gt;3. I checked the rule against my own code &lt;a class="anchor" href="#3-i-checked-the-rule-against-my-own-code" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I pulled the daily download numbers for the packages I use and looked for workarounds, patches and forks in my own source.&lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Package&lt;/th&gt;&#10;&lt;th&gt;Downloads per day&lt;/th&gt;&#10;&lt;th&gt;What it cost me&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;requests&lt;/td&gt;&#10;&lt;td&gt;49M&lt;/td&gt;&#10;&lt;td&gt;nothing I had to work around&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;pydantic&lt;/td&gt;&#10;&lt;td&gt;35M&lt;/td&gt;&#10;&lt;td&gt;nothing&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;numpy&lt;/td&gt;&#10;&lt;td&gt;33M&lt;/td&gt;&#10;&lt;td&gt;nothing&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;httpx&lt;/td&gt;&#10;&lt;td&gt;25M&lt;/td&gt;&#10;&lt;td&gt;nothing&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;aiohttp&lt;/td&gt;&#10;&lt;td&gt;18M&lt;/td&gt;&#10;&lt;td&gt;nothing&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;FastAPI&lt;/td&gt;&#10;&lt;td&gt;17M&lt;/td&gt;&#10;&lt;td&gt;nothing&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;chromadb&lt;/td&gt;&#10;&lt;td&gt;270K&lt;/td&gt;&#10;&lt;td&gt;workarounds for a bug that holds the GIL&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;matrix-js-sdk&lt;/td&gt;&#10;&lt;td&gt;~100K&lt;/td&gt;&#10;&lt;td&gt;patched&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;mem0ai&lt;/td&gt;&#10;&lt;td&gt;79K&lt;/td&gt;&#10;&lt;td&gt;largely reimplemented&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;agno&lt;/td&gt;&#10;&lt;td&gt;78K&lt;/td&gt;&#10;&lt;td&gt;&lt;strong&gt;126 documented workarounds&lt;/strong&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;matrix-nio&lt;/td&gt;&#10;&lt;td&gt;23K&lt;/td&gt;&#10;&lt;td&gt;forked&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Above a million a day, I had nothing to work around.&#10;Below it, every package on this list cost me a patch, a fork, a rewrite, or a pile of workarounds.&lt;/p&gt;&#10;&lt;p&gt;Take &lt;a href="https://github.com/chroma-core/chroma" target="_blank" rel="noopener"&gt;ChromaDB&lt;/a&gt;, the vector database behind MindRoom&amp;rsquo;s knowledge bases.&#10;In some cases it holds Python&amp;rsquo;s &lt;span class="hover-tip" data-tooltip="The Global Interpreter Lock: only one thread can run Python code at a time. Native code is supposed to release it while it waits, so other threads can keep going." tabindex="0"&gt;GIL&lt;/span&gt; during I/O, which blocks every other thread in the process.&#10;I opened &lt;a href="https://github.com/chroma-core/chroma/pull/7692" target="_blank" rel="noopener"&gt;a pull request&lt;/a&gt; to fix it, and nobody has looked at it yet.&#10;Instead of forking, I run every knowledge read in a short-lived child process, because a process can be killed and a blocked thread cannot.&lt;sup id="fnref:5"&gt;&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref"&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;My fork of matrix-nio has about 8,900 lines added and 2,000 removed in the library code since the last upstream release.&lt;sup id="fnref:6"&gt;&lt;a href="#fn:6" class="footnote-ref" role="doc-noteref"&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;This does not mean every small package needs replacing.&#10;MindRoom pulls in a few hundred packages in total, and plenty of them have modest download numbers.&#10;The scrutiny should match how much I depend on a package.&#10;Something I use for one small, specific purpose is fine.&#10;Agno and matrix-nio are the base that MindRoom is built on, which is probably also why they hurt the most.&lt;/p&gt;&#10;&lt;h2 id="4-roll-your-own-the-library-gives-you-the-easy-10"&gt;4. Roll your own: the library gives you the easy 10% &lt;a class="anchor" href="#4-roll-your-own-the-library-gives-you-the-easy-10" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Take memory libraries, &lt;a href="https://github.com/mem0ai/mem0" target="_blank" rel="noopener"&gt;Mem0&lt;/a&gt; and friends.&#10;I have &lt;a href="https://www.nijho.lt/post/file-based-rag-memory/"&gt;already written about this&lt;/a&gt;: I cloned LlamaIndex, LangChain, Letta, Mem0 and PydanticAI, studied how they work, and re-implemented the parts I needed. My memory system ended up &amp;ldquo;mostly modeled after Mem0&amp;rdquo;.&lt;/p&gt;&#10;&lt;p&gt;The core idea is not hard.&#10;With &lt;span class="hover-tip" data-tooltip="Retrieval-augmented generation: look up relevant text first and paste it into the prompt, so the model answers from your documents instead of from memory." tabindex="0"&gt;RAG&lt;/span&gt;, you chunk, embed, retrieve, re-rank and reconcile. Once you have read a couple of implementations you can write it, and afterwards you understand every line.&lt;/p&gt;&#10;&lt;p&gt;The same is true of an agent framework.&#10;It builds a JSON payload, posts it to an HTTP endpoint, parses a &lt;span class="hover-tip" data-tooltip="Providers send the reply as server-sent events: a long-lived HTTP response with one small JSON chunk per token or tool-call fragment." tabindex="0"&gt;streaming response&lt;/span&gt;, keeps a list of messages, and loops when the model asks for a tool call.&#10;With AI, that is a day or two of work.&lt;/p&gt;&#10;&lt;p&gt;The hard part is making it reliable at scale: never blocking the &lt;span class="hover-tip" data-tooltip="In async Python, one thread runs all tasks by switching between them. A single call that blocks freezes every conversation at once." tabindex="0"&gt;event loop&lt;/span&gt;, and handling the crazy edge cases.&#10;With an agent system you end up building a very complicated state machine, and if you do not watch it, any combination of states is possible. Almost all of them are edge cases.&lt;/p&gt;&#10;&lt;p&gt;A library gives you the easy 10% and leaves you the hard 90%.&#10;And you do that 90% inside somebody else&amp;rsquo;s code, where you cannot fix the root cause.&lt;/p&gt;&#10;&lt;p&gt;MindRoom is now about 360,000 lines of Python, plus about 750,000 lines of tests.&lt;sup id="fnref:7"&gt;&lt;a href="#fn:7" class="footnote-ref" role="doc-noteref"&gt;7&lt;/a&gt;&lt;/sup&gt;&#10;A good part of that is code I wrote instead of depending on a library:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Memory and knowledge:&lt;/strong&gt; about 15,600 lines across 50 files.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Conversation history and &lt;span class="hover-tip" data-tooltip="Summarizing older turns of a conversation so a long thread still fits in the model&amp;#39;s context window." tabindex="0"&gt;compaction&lt;/span&gt;:&lt;/strong&gt; about 8,400 lines.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;An OpenAI-compatible API:&lt;/strong&gt; about 2,300 lines, so MindRoom agents show up as selectable &amp;ldquo;models&amp;rdquo; in any chat frontend that speaks the OpenAI protocol.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude provider support:&lt;/strong&gt; about 3,000 lines.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;If I have to write the hard 90% either way, I might as well write the easy 10% too.&lt;/p&gt;&#10;&lt;h2 id="5-fork-your-own-when-the-problem-is-hard"&gt;5. Fork your own: when the problem is hard &lt;a class="anchor" href="#5-fork-your-own-when-the-problem-is-hard" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I am not going to write my own &lt;span class="hover-tip" data-tooltip="Matrix encryption means per-device keys, the Olm and Megolm ratchets, cross-signing, device verification and key backup, all of which have to interoperate with every other client." tabindex="0"&gt;end-to-end encrypted&lt;/span&gt; Matrix SDK, or my own &lt;span class="hover-tip" data-tooltip="The server that stores your rooms and syncs them with other Matrix servers, like a mail server for chat." tabindex="0"&gt;homeserver&lt;/span&gt;.&#10;Those are hard, and also far below the line.&#10;So there I fork.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;I forked the Python Matrix client.&lt;/strong&gt; MindRoom ships its own fork of matrix-nio rather than the upstream package.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;I forked the Matrix server, twice.&lt;/strong&gt; First &lt;span class="hover-tip" data-tooltip="The original Matrix homeserver, written in Python by the Matrix.org team." tabindex="0"&gt;Synapse&lt;/span&gt;. When I ran into scaling problems I moved to &lt;a href="https://github.com/matrix-construct/tuwunel" target="_blank" rel="noopener"&gt;Tuwunel&lt;/a&gt; and forked that.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;I forked the web client.&lt;/strong&gt; &lt;a href="https://github.com/cinnyapp/cinny" target="_blank" rel="noopener"&gt;Cinny&lt;/a&gt; is the Matrix web client MindRoom uses.&lt;/p&gt;&#10;&lt;p&gt;None of these are AI projects. AI is just where I felt it most.&lt;/p&gt;&#10;&lt;p&gt;Whether a fork stays a fork depends on the maintainers.&#10;Tuwunel is extremely receptive to my patches, so I upstream anything that is general enough, and over the last six months I am its fourth most active contributor by commits.&lt;sup id="fnref:8"&gt;&lt;a href="#fn:8" class="footnote-ref" role="doc-noteref"&gt;8&lt;/a&gt;&lt;/sup&gt;&#10;Cinny has not accepted any of my pull requests, so I forked it and stopped trying to upstream.&#10;Same with &lt;span class="hover-tip" data-tooltip="An open-source, self-hosted ChatGPT-style web interface that can talk to many model providers." tabindex="0"&gt;LibreChat&lt;/span&gt;: I had patches open for over a year without a reply, so I forked.&lt;/p&gt;&#10;&lt;p&gt;Keeping a fork up to date used to be miserable.&#10;With an LLM doing the rebasing, pulling in the latest upstream is now cheap, though still a bit of a risk every time.&#10;The bigger cost is that once you fork, you are responsible for the whole codebase, including the parts you never changed.&lt;/p&gt;&#10;&lt;h3 id="agno-patches-instead-of-a-fork"&gt;Agno: patches instead of a fork &lt;a class="anchor" href="#agno-patches-instead-of-a-fork" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I did not fork Agno. I &lt;span class="hover-tip" data-tooltip="Replacing a library&amp;#39;s functions or methods at runtime from your own code, without changing the installed package." tabindex="0"&gt;monkey-patched&lt;/span&gt; it.&#10;Agno is very actively developed, I have talked to the maintainer, and they know about these problems, so I hoped to upstream my fixes.&#10;I have filed 33 issues and pull requests there.&lt;sup id="fnref:9"&gt;&lt;a href="#fn:9" class="footnote-ref" role="doc-noteref"&gt;9&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;That got out of hand.&#10;MindRoom now carries &lt;strong&gt;126 documented workarounds&lt;/strong&gt; for Agno across 59 files.&#10;Most of them live in 36 dedicated compatibility modules, about 7,200 lines of code, with the rest patched inline in 23 other files.&#10;Every one uses the same comment format, so I can &lt;a href="https://github.com/search?q=repo%3Amindroom-ai%2Fmindroom&amp;#43;AGNO_COMPAT&amp;amp;type=code" target="_blank" rel="noopener"&gt;find all of them with one search&lt;/a&gt;.&#10;Each one says what is wrong upstream, links the issue or PR, and says when I can delete it.&lt;sup id="fnref:10"&gt;&lt;a href="#fn:10" class="footnote-ref" role="doc-noteref"&gt;10&lt;/a&gt;&lt;/sup&gt;&#10;A few examples:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Search failures become plausible empty results.&lt;/strong&gt; A failed knowledge search and an empty index return the same empty list, so my agents confidently told me things did not exist.&lt;sup id="fnref:11"&gt;&lt;a href="#fn:11" class="footnote-ref" role="doc-noteref"&gt;11&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Streamed tool calls get malformed or merged.&lt;/strong&gt;&lt;sup id="fnref:12"&gt;&lt;a href="#fn:12" class="footnote-ref" role="doc-noteref"&gt;12&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reasoning is silently lost when tool calls are replayed.&lt;/strong&gt;&lt;sup id="fnref:13"&gt;&lt;a href="#fn:13" class="footnote-ref" role="doc-noteref"&gt;13&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Provider errors collapse into a generic 502&lt;/strong&gt;, which throws away the error code you need to decide whether to retry.&lt;sup id="fnref:14"&gt;&lt;a href="#fn:14" class="footnote-ref" role="doc-noteref"&gt;14&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;At this size, the patches amount to a fork.&lt;/p&gt;&#10;&lt;h2 id="6-i-am-not-dunking-on-open-source-including-mine"&gt;6. I am not dunking on open source, including mine &lt;a class="anchor" href="#6-i-am-not-dunking-on-open-source-including-mine" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Everything I named is open source I use every day, for free, built by people doing their best.&#10;I filed issues and PRs, and where maintainers merged fixes I deleted my workarounds.&lt;/p&gt;&#10;&lt;p&gt;My own software is in the same category.&#10;Most new AI tooling is not very good, and MindRoom may well be included.&#10;It is large, fast-moving, and nowhere near millions of daily downloads.&#10;By my own rule, you should think twice before depending on it.&lt;/p&gt;&#10;&lt;p&gt;I also have to admit that I have not yet built a project the roll-your-own way from the start.&#10;So comparing &amp;ldquo;what I would do next time&amp;rdquo; with what I actually did is not entirely fair.&#10;This is what I think right now, and a year from now I may have to write another post correcting this one.&lt;/p&gt;&#10;&lt;h2 id="7-my-rule-for-the-next-uv-add"&gt;7. My rule for the next &lt;code&gt;uv add&lt;/code&gt; &lt;a class="anchor" href="#7-my-rule-for-the-next-uv-add" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I weigh three questions.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;How many projects use it?&lt;/strong&gt;&#10;Daily downloads of the actual package, not stars, and not how many people use the product built on top.&#10;In the millions: depend on it.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;How much do I rely on it?&lt;/strong&gt;&#10;Agno and matrix-nio are the base of MindRoom.&#10;A library I use in a CLI to format a question is not, and if I use it in a narrow way I do not need my own version.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;How hard is it, and how receptive is upstream?&lt;/strong&gt;&#10;If the library is something AI can write in a couple of days, roll my own.&#10;If it is hard, fork it.&#10;If the maintainers accept patches, upstream what is general enough.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;If I started MindRoom over today, I would write the HTTP requests to the model providers myself.&lt;/strong&gt;&#10;Not even the OpenAI or Anthropic SDKs.&#10;And even httpx is less safe than its download numbers suggest: in early 2026 its maintainer closed the issue tracker and discussions, and the latest stable release is from December 2024.&lt;sup id="fnref:15"&gt;&lt;a href="#fn:15" class="footnote-ref" role="doc-noteref"&gt;15&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;In 2025 I wrote that the right answer is &amp;ldquo;it depends on the situation&amp;rdquo;, and I still believe that.&#10;I just had the wrong threshold.&#10;Battle-tested means millions of downloads a day.&#10;Below that: roll your own, and fork the rest.&lt;/p&gt;&#10;&lt;div class="footnotes" role="doc-endnotes"&gt;&#10;&lt;hr&gt;&#10;&lt;ol&gt;&#10;&lt;li id="fn:1"&gt;&#10;&lt;p&gt;From the GitHub API (&lt;code&gt;api.github.com/repos/agno-agi/agno&lt;/code&gt;) on 2026-10-02: 42,385 stars and 6,041 forks.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:2"&gt;&#10;&lt;p&gt;PyPI numbers are the &lt;code&gt;last_day&lt;/code&gt; field of the &lt;a href="https://pypistats.org" target="_blank" rel="noopener"&gt;pypistats.org&lt;/a&gt; API (&lt;code&gt;/api/packages/&amp;lt;name&amp;gt;/recent&lt;/code&gt;), fetched on 2026-10-02, except uv, fetched on 2026-10-18 (3,648,827). The matrix-js-sdk number is npm&amp;rsquo;s weekly download count (about 730,000) divided by seven. Daily numbers wobble, so treat them as orders of magnitude.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:3"&gt;&#10;&lt;p&gt;When events arrive for a thread that has not finished initializing, the SDK&amp;rsquo;s replay path never applies them, so an &lt;code&gt;m.replace&lt;/code&gt; edit (the event type Matrix uses for &amp;ldquo;this replaces message X&amp;rdquo;) is stored and never shown. I replayed a captured event trace through the SDK: unpatched, zero of seventeen edits reached the listeners; patched, all seventeen. MindRoom carries the fix as a &lt;code&gt;patch-package&lt;/code&gt; patch on the SDK&amp;rsquo;s &lt;code&gt;thread.ts&lt;/code&gt;.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:4"&gt;&#10;&lt;p&gt;For each direct dependency I looked at three things in the MindRoom repository: whether &lt;code&gt;pyproject.toml&lt;/code&gt; pins a fork instead of the upstream package, whether &lt;code&gt;patch-package&lt;/code&gt; patches it, and whether the source has workaround markers or comments pointing at upstream issues for it. The packages above a million downloads a day had none of those.&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:5"&gt;&#10;&lt;p&gt;The PR is titled &amp;ldquo;Release GIL during metadata I/O&amp;rdquo;. On the MindRoom side, &lt;code&gt;knowledge/read_process.py&lt;/code&gt; starts the child process, and a TODO says to remove it once a Chroma release with the fix is pinned. A blocked thread holding the GIL cannot be interrupted from Python, but the kernel will always terminate a child process.&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:6"&gt;&#10;&lt;p&gt;Compared with upstream matrix-nio 0.25.2 (released 2024-10-04): &lt;code&gt;git diff --shortstat&lt;/code&gt; on the library code gives 8,872 lines added and 1,966 removed across 52 files, from 89 commits, 76 of them mine. The fork is published on PyPI as &lt;code&gt;mindroom-nio&lt;/code&gt;.&amp;#160;&lt;a href="#fnref:6" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:7"&gt;&#10;&lt;p&gt;Counted with &lt;code&gt;git ls-files&lt;/code&gt; and &lt;code&gt;wc -l&lt;/code&gt; on the MindRoom repository on 2026-10-18: 360,513 lines in 1,222 Python files under &lt;code&gt;src/&lt;/code&gt;, 750,657 lines under &lt;code&gt;tests/&lt;/code&gt;, and another 81,543 lines of TypeScript in the frontend. The per-feature numbers below come from the same count over the relevant directories.&amp;#160;&lt;a href="#fnref:7" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:8"&gt;&#10;&lt;p&gt;Non-merge commits on Tuwunel&amp;rsquo;s main branch since 2026-04-18: Jason Volk 1,332, June Strawberry 325, dasha_uwu 55, me 42.&amp;#160;&lt;a href="#fnref:8" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:9"&gt;&#10;&lt;p&gt;Issues and pull requests in &lt;a href="https://github.com/agno-agi/agno/issues?q=author%3Abasnijholt" target="_blank" rel="noopener"&gt;agno-agi/agno&lt;/a&gt; with me as the author, counted on 2026-10-02.&amp;#160;&lt;a href="#fnref:9" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:10"&gt;&#10;&lt;p&gt;Every workaround starts with a comment like &lt;code&gt;# AGNO_COMPAT: Knowledge search hides provider failures as empty results.&lt;/code&gt;, followed by &lt;code&gt;Reason:&lt;/code&gt;, &lt;code&gt;Upstream issue:&lt;/code&gt;, &lt;code&gt;Upstream PR:&lt;/code&gt;, &lt;code&gt;Remove when:&lt;/code&gt; and the tests that cover it. The counts come from &lt;code&gt;grep&lt;/code&gt; over &lt;code&gt;src/&lt;/code&gt;: 126 &lt;code&gt;AGNO_COMPAT:&lt;/code&gt; markers in 59 files, and 7,160 lines in the 36 &lt;code&gt;agno_compat_*&lt;/code&gt; modules.&amp;#160;&lt;a href="#fnref:10" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:11"&gt;&#10;&lt;p&gt;&lt;code&gt;Knowledge.search&lt;/code&gt; catches vector store and provider errors and returns &lt;code&gt;[]&lt;/code&gt;. &lt;a href="https://github.com/agno-agi/agno/issues/10150" target="_blank" rel="noopener"&gt;agno#10150&lt;/a&gt;, partially fixed by &lt;a href="https://github.com/agno-agi/agno/pull/10152" target="_blank" rel="noopener"&gt;agno#10152&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:11" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:12"&gt;&#10;&lt;p&gt;When a streamed tool-call index does not start at zero, Agno leaves empty placeholder calls. &lt;a href="https://github.com/agno-agi/agno/issues/8879" target="_blank" rel="noopener"&gt;agno#8879&lt;/a&gt;, fix proposed in &lt;a href="https://github.com/agno-agi/agno/pull/8880" target="_blank" rel="noopener"&gt;agno#8880&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:12" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:13"&gt;&#10;&lt;p&gt;With the OpenAI Responses API, Agno keeps only the last reasoning item, so it cannot be replayed with the tool calls it belonged to. &lt;a href="https://github.com/agno-agi/agno/issues/9960" target="_blank" rel="noopener"&gt;agno#9960&lt;/a&gt;; partial fixes landed in &lt;a href="https://github.com/agno-agi/agno/pull/10075" target="_blank" rel="noopener"&gt;agno#10075&lt;/a&gt; and &lt;a href="https://github.com/agno-agi/agno/pull/10395" target="_blank" rel="noopener"&gt;agno#10395&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:13" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:14"&gt;&#10;&lt;p&gt;Unclassified &lt;code&gt;ModelProviderError&lt;/code&gt; failures default to HTTP 502, so a real network blip and a permanent error look the same. &lt;a href="https://github.com/agno-agi/agno/issues/8869" target="_blank" rel="noopener"&gt;agno#8869&lt;/a&gt;, partially addressed by &lt;a href="https://github.com/agno-agi/agno/pull/8870" target="_blank" rel="noopener"&gt;agno#8870&lt;/a&gt;.&amp;#160;&lt;a href="#fnref:14" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:15"&gt;&#10;&lt;p&gt;The latest stable release on &lt;a href="https://pypi.org/project/httpx/#history" target="_blank" rel="noopener"&gt;PyPI&lt;/a&gt; is 0.28.1, uploaded 2024-12-06. There have been 1.0 development pre-releases since, the latest in August 2026. The closing of issues and discussions was widely discussed in the Python community in March 2026.&amp;#160;&lt;a href="#fnref:15" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/div&gt;&#10;</description></item><item><title>Why Docker isn't an AI-safe sandbox anymore, and how I fixed it in MindRoom 🔒</title><link>https://www.nijho.lt/post/kernels-containers-vms/</link><pubDate>Sun, 18 Oct 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/kernels-containers-vms/</guid><description>&lt;p&gt;For years, a Docker container was my default answer to &amp;ldquo;where do I run this?&amp;rdquo;&#10;I never thought it was a perfect sandbox.&#10;It was good enough, because getting out of one usually meant finding a specific kind of bug in the Linux kernel itself, and those were hard to find.&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;AI models have become very good at finding security bugs, including in Linux.&#10;Anthropic and OpenAI now keep their strongest security models, &lt;a href="https://www.anthropic.com/claude/mythos" target="_blank" rel="noopener"&gt;Claude Mythos&lt;/a&gt; and &lt;a href="https://openai.com/the-defense-factory/" target="_blank" rel="noopener"&gt;Daybreak Blue&lt;/a&gt;, behind identity checks and vetting.&#10;Open-weight models, which anyone can download and run, come with no such rules, and they trail the closed ones by only &lt;a href="https://epoch.ai/data-insights/open-closed-cyber-eci-gap" target="_blank" rel="noopener"&gt;six to seven months&lt;/a&gt;.&#10;Once there is an open model as good as Mythos, anyone can strip out its refusals with a tool like &lt;a href="https://github.com/p-e-w/heretic" target="_blank" rel="noopener"&gt;Heretic&lt;/a&gt; (people call this abliteration) and point it at the Linux kernel.&#10;The security company DepthFirst used its own model to find a way out of a container and titled the write-up &lt;a href="https://depthfirst.com/research/containers-are-no-longer-safe" target="_blank" rel="noopener"&gt;Containers Are No Longer a Security Boundary&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;I care about this because running untrusted code in containers is exactly what &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom&lt;/a&gt;, my open-source system for AI agents that live in Matrix chat rooms, does.&#10;Every agent can get its own Docker worker, and its shell, file, Python, and browser tools run there.&#10;It can install anything, start background processes, and drive a real browser.&#10;And as I wrote in &lt;a href="https://www.nijho.lt/post/btrfs-to-zfs/"&gt;my ZFS post&lt;/a&gt;, I run coding agents in &lt;span class="hover-tip" data-tooltip="The agent runs every command without asking me for approval first." tabindex="0"&gt;YOLO mode&lt;/span&gt;, exclusively.&#10;I do not review the commands they run, I look at the results.&lt;/p&gt;&#10;&lt;p&gt;So both sides changed at once.&#10;The code inside the container is now written by an AI, and the bugs that let it out are now found by an AI.&#10;A &lt;a href="https://youtu.be/9-2CSJC114k" target="_blank" rel="noopener"&gt;video from the Low Level channel&lt;/a&gt; asking whether containers are still safe made me sit down and rethink my setup.&lt;/p&gt;&#10;&lt;p&gt;I am not an expert in any of this.&#10;I have used containers, KVM, and hypervisors for years, including Proxmox before I &lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;moved to NixOS&lt;/a&gt;, but I never deeply understood what happens underneath.&#10;Building this forced me to learn it, and writing this post is my exercise in understanding it all.&#10;All of this is very complicated (as is everything new), and I am still learning.&#10;I am sure I skip over a lot and simplify the rest; what is here are the parts that helped me understand it.&#10;I thought it would be nice to share.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; A container is a process on your machine that the kernel dresses up as a separate computer.&#10;Every container shares that one kernel with the host, so a single bug in it can be a way out.&#10;MindRoom can now give each agent&amp;rsquo;s worker its own kernel, with one setting and six lines of code.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#what-the-kernel-actually-does"&gt;What the kernel actually does&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#a-container-is-a-process-in-a-costume"&gt;A container is a process in a costume&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-kernel-bugs-are-a-bigger-problem-now"&gt;Why kernel bugs are a bigger problem now&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#so-i-asked-a-model-to-break-out"&gt;So I asked a model to break out&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#stronger-walls-virtual-machines"&gt;Stronger walls: virtual machines&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#kata-containers-and-gvisor"&gt;Kata Containers and gVisor&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-pr-six-lines"&gt;The PR: six lines&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-it-costs"&gt;What it costs&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-this-does-not-fix"&gt;What this does not fix&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="what-the-kernel-actually-does"&gt;What the kernel actually does &lt;a class="anchor" href="#what-the-kernel-actually-does" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When people talk about Linux, they usually mean an operating system like Ubuntu, Fedora, or NixOS.&#10;Those differ in almost everything you see: package managers, desktops, config files.&#10;What they all have in common is the kernel, the part Linus Torvalds started in 1991 and still leads today.&#10;Strictly speaking, that kernel is the only part called Linux.&lt;/p&gt;&#10;&lt;p&gt;The kernel is the one program on a Linux machine that talks to the hardware directly.&#10;Everything else, your shell, Python, Chrome, Docker, runs on top of it and has to ask it for things.&#10;Open this file.&#10;Give me some memory.&#10;Send this packet.&#10;Start a new process.&#10;Those requests are called system calls, or syscalls for short.&lt;/p&gt;&#10;&lt;p&gt;There is one kernel per machine, and it decides who is allowed to do what.&#10;That makes it the most trusted code on the system.&#10;Most kernel bugs only crash the machine or cause glitches.&#10;But some let a normal program become root, the admin account, or even run its own code inside the kernel.&#10;At that point it can do anything on the machine, including leaving any container it was in.&lt;/p&gt;&#10;&lt;h2 id="a-container-is-a-process-in-a-costume"&gt;A container is a process in a costume &lt;a class="anchor" href="#a-container-is-a-process-in-a-costume" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When you &lt;code&gt;docker run -it ubuntu&lt;/code&gt;, you get a root shell in what feels like a fresh computer.&#10;Under the hood it is one ordinary process.&#10;The kernel dresses it up using three features:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Namespaces&lt;/strong&gt; decide what the process can see. It gets its own list of processes (where it is process number 1), its own filesystem, and its own network. Root inside is still root on the host, with &lt;span class="hover-tip" data-tooltip="Docker drops most of root&amp;#39;s special powers, which Linux calls capabilities, and seccomp and AppArmor block more. Namespaces only change what root can see." tabindex="0"&gt;most of its powers taken away&lt;/span&gt;.&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;cgroups&lt;/strong&gt; decide how much it can use: CPU, memory, number of processes.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;seccomp&lt;/strong&gt; decides which syscalls it may make at all. It is a filter that blocks the ones a normal program never needs.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/kernels-containers-vms/container-kernel.svg" alt="Two containers and the host&amp;#39;s own processes all make syscalls into one shared Linux kernel, which keeps the containers apart with namespaces, cgroups and seccomp. One bug in that kernel reaches every container and the host." loading="lazy" data-zoomable&gt;&lt;/figure&gt;&#10;&lt;p&gt;There is no second kernel.&#10;Every syscall from inside a container lands in the same kernel as every other container and the host itself.&#10;The kernel enforces the isolation, and it is also what gets attacked.&lt;/p&gt;&#10;&lt;p&gt;For most uses that is fine.&#10;Usually you put fixed software in a container: a database, a web app, some self-hosted service.&#10;You know where that code comes from, you keep your kernel patched, and that is good enough.&lt;/p&gt;&#10;&lt;p&gt;An AI agent is different.&#10;It writes new code on the spot and runs it, and nobody knows in advance what that code will do.&lt;/p&gt;&#10;&lt;p&gt;Since root in a container is root on the host, anyone who can use Docker can start a container as root and mount any folder from the host into it.&#10;They can then read and change every file in that folder, including files their own account may not open.&#10;Docker&amp;rsquo;s own documentation says the &lt;code&gt;docker&lt;/code&gt; group &lt;a href="https://docs.docker.com/engine/install/linux-postinstall/" target="_blank" rel="noopener"&gt;grants root-level privileges&lt;/a&gt;.&#10;I knew that in theory, but it only clicked when I watched an AI agent do it on a machine where I had no root, only Docker access.&#10;It needed to change files it was not allowed to touch, so it started a small container, mounted their folder, and edited them from inside.&#10;No kernel bug needed.&lt;/p&gt;&#10;&lt;h2 id="why-kernel-bugs-are-a-bigger-problem-now"&gt;Why kernel bugs are a bigger problem now &lt;a class="anchor" href="#why-kernel-bugs-are-a-bigger-problem-now" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Kernel bugs that let a normal program take over the whole machine used to take skilled people weeks or months to find and exploit.&#10;The famous ones, like &lt;a href="https://dirtycow.ninja" target="_blank" rel="noopener"&gt;Dirty COW&lt;/a&gt; in 2016, made the news every year or two, you patched, and that was it.&lt;/p&gt;&#10;&lt;p&gt;AI is speeding this up, and the DepthFirst write-up I mentioned is a good example.&#10;Their model found a bug in the kernel code for Unix sockets, which programs on the same machine use to talk to each other.&#10;The kernel freed a piece of memory and then kept using it, a so-called use-after-free, and from inside a container that was enough to get out.&#10;Their conclusion is that you should assume attackers can escape containers at will.&lt;/p&gt;&#10;&lt;p&gt;Blocking more syscalls, or taking more powers away from root, helps a little.&#10;But it only narrows which parts of the shared kernel a container can reach.&#10;This bug sat in Unix sockets, which almost every program uses, including the browser the agent drives, so blocking them would break the agent.&lt;/p&gt;&#10;&lt;p&gt;Now put an AI agent in that container.&#10;It reads web pages and repositories written by strangers, and one of those could talk it into running an exploit.&#10;On a MindRoom server, getting out of a worker means getting onto the machine that runs MindRoom itself.&#10;That is where the API keys, Matrix logins, and stored credentials live, which the workers are built to never see.&lt;/p&gt;&#10;&lt;h2 id="so-i-asked-a-model-to-break-out"&gt;So I asked a model to break out &lt;a class="anchor" href="#so-i-asked-a-model-to-break-out" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Before changing anything, I wanted to know how real this was for my own setup.&#10;I gave a MindRoom agent &lt;a href="https://openai.com/the-defense-factory/" target="_blank" rel="noopener"&gt;Daybreak Blue&lt;/a&gt; and asked it to escape its worker container using known kernel vulnerabilities.&#10;Daybreak Blue is OpenAI&amp;rsquo;s security model for verified users, so it does the offensive security work that other models refuse.&lt;/p&gt;&#10;&lt;p&gt;It did not get out, which was reassuring.&#10;But it only tried known bugs.&#10;A kernel a few weeks behind on patches, or a bug nobody has published yet, would be a different story.&#10;So the attempt tells me the easy path was closed that day, and not much more.&lt;/p&gt;&#10;&lt;h2 id="stronger-walls-virtual-machines"&gt;Stronger walls: virtual machines &lt;a class="anchor" href="#stronger-walls-virtual-machines" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The classic answer is a virtual machine.&#10;A container shares the host&amp;rsquo;s kernel, but a VM brings its own, and this is where the hardware comes in.&#10;Modern CPUs have a virtualization mode built in, called VT-x on Intel and AMD-V on AMD.&#10;In that mode, a second kernel, the guest kernel, runs directly on the real CPU and believes it is in charge, while the CPU quietly limits it.&#10;When the guest tries something it may not do on its own, like talking to a disk or a network card, the CPU pauses the guest and hands control to the host.&#10;This is called a VM exit.&#10;Despite the name, nothing escapes and nothing crashes.&#10;The host handles the request, for example by pretending to be that disk, and then resumes the guest where it stopped.&#10;From the guest&amp;rsquo;s point of view, the instruction simply finished.&lt;/p&gt;&#10;&lt;p&gt;Memory is fenced off too.&#10;The host gives the CPU a separate map of which real memory each guest may use, and the CPU checks every memory access against it.&#10;So even a guest kernel with full privileges cannot touch the host&amp;rsquo;s memory.&lt;/p&gt;&#10;&lt;p&gt;The CPU only provides the mechanism.&#10;The software that sets the rules and handles the VM exits is called the hypervisor.&#10;&amp;ldquo;Hypervisor&amp;rdquo; is a role, not one program, and on Linux it is two pieces:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;KVM&lt;/strong&gt;, a module in the Linux kernel, uses the CPU&amp;rsquo;s virtualization mode to run the guest, keeps that memory map, and catches its VM exits. It shows up as the device &lt;code&gt;/dev/kvm&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;A VMM&lt;/strong&gt; (virtual machine monitor), a normal program on top, sets up the VM and handles the exits that KVM passes up, for example by pretending to be the guest&amp;rsquo;s disk and network card. &lt;a href="https://www.qemu.org" target="_blank" rel="noopener"&gt;QEMU&lt;/a&gt;, &lt;a href="https://firecracker-microvm.github.io" target="_blank" rel="noopener"&gt;Firecracker&lt;/a&gt;, and &lt;a href="https://www.cloudhypervisor.org" target="_blank" rel="noopener"&gt;Cloud Hypervisor&lt;/a&gt; are three VMMs you can pick from.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Proxmox, which I mentioned above, is KVM plus QEMU.&#10;AWS Lambda is KVM plus Firecracker.&lt;/p&gt;&#10;&lt;p&gt;Code in a VM talks to its own guest kernel.&#10;To reach the host, it usually has to break that kernel first and then the hypervisor.&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;&#10;That is still possible.&#10;Google Project Zero turned &lt;a href="https://googleprojectzero.blogspot.com/2021/06/an-epyc-escape-case-study-of-kvm.html" target="_blank" rel="noopener"&gt;a bug in how KVM runs VMs inside VMs on AMD&lt;/a&gt; into a full escape in 2021.&#10;Google&amp;rsquo;s &lt;a href="https://security.googleblog.com/2024/06/virtual-escape-real-reward-introducing.html" target="_blank" rel="noopener"&gt;kvmCTF&lt;/a&gt; pays up to &lt;span class="hover-tip" data-tooltip="The top reward in the current kvmCTF rules, for a full escape from the guest VM to the host." tabindex="0"&gt;$250,000&lt;/span&gt; for a new one.&#10;And this year, one researcher, Hyunwoo Kim, published &lt;a href="https://github.com/V4bel/Zapscape" target="_blank" rel="noopener"&gt;three KVM escapes&lt;/a&gt;, one of them hidden in KVM &lt;span class="hover-tip" data-tooltip="Januscape, CVE-2026-53359: a use-after-free in the shadow page tables of x86 KVM, added in August 2010 and fixed in June 2026." tabindex="0"&gt;since 2010&lt;/span&gt;.&lt;/p&gt;&#10;&lt;p&gt;The difference between a container and a VM is how much code an attacker can reach, and that gap is large.&#10;On x86 (the Intel and AMD chips in most PCs and servers), Linux has &lt;span class="hover-tip" data-tooltip="The x86_64 syscall table of Linux 7.3-rc7 has 386 entries for 64-bit programs, and 16 of them are empty slots that only return an error." tabindex="0"&gt;about 370 syscalls&lt;/span&gt;, and Docker&amp;rsquo;s &lt;a href="https://docs.docker.com/engine/security/seccomp/" target="_blank" rel="noopener"&gt;default seccomp filter&lt;/a&gt; blocks &lt;span class="hover-tip" data-tooltip="Docker&amp;#39;s documentation says its default profile disables around 44 system calls out of 300&amp;#43;. The current profile blocks a few more, like the io_uring calls." tabindex="0"&gt;a few dozen&lt;/span&gt; of them.&#10;Behind the rest sit the kernel&amp;rsquo;s filesystems, networking, memory management, and core code: &lt;span class="hover-tip" data-tooltip="The fs, net, mm and kernel folders of Linux 7.3-rc7, counted with tokei, comments and blank lines included. The whole tree is 43 million lines, 26.5 million of them drivers." tabindex="0"&gt;about 3.8 million lines&lt;/span&gt;, even without counting drivers.&#10;Not all of that is reachable from a container, but a lot of it is.&#10;KVM on x86 is &lt;span class="hover-tip" data-tooltip="arch/x86/kvm plus virt/kvm in the same Linux 7.3-rc7 tree, counted the same way: 113,720 lines." tabindex="0"&gt;about 114,000 lines&lt;/span&gt;.&#10;On top of KVM comes the VMM, but only the few devices it fakes for the guest.&#10;Most QEMU escapes came from its many emulated devices, which is why Firecracker and Cloud Hypervisor keep that list short.&lt;/p&gt;&#10;&lt;p&gt;Google&amp;rsquo;s bug bounties point the same way.&#10;&lt;a href="https://google.github.io/security-research/kernelctf/rules.html" target="_blank" rel="noopener"&gt;kernelCTF&lt;/a&gt; pays &lt;span class="hover-tip" data-tooltip="One fixed amount per accepted exploit, according to the current kernelCTF rules." tabindex="0"&gt;$71,337&lt;/span&gt; for each new kernel exploit that turns a normal user into root, and Google&amp;rsquo;s &lt;a href="https://github.com/google/security-research/tree/master/pocs/linux/kernelctf" target="_blank" rel="noopener"&gt;public repository&lt;/a&gt; holds exploits for &lt;span class="hover-tip" data-tooltip="119 exploit folders in pocs/linux/kernelctf, covering 93 unique CVEs, at commit 79f049dc from October 16, 2026." tabindex="0"&gt;93 different kernel bugs&lt;/span&gt;.&#10;kvmCTF pays more than three times as much, and the same repository holds &lt;span class="hover-tip" data-tooltip="The only folder in pocs/linux/kvmctf at the same commit: a NULL pointer dereference reached through nested virtualization. Januscape was also used in kvmCTF but is not in the repository yet." tabindex="0"&gt;one KVM exploit&lt;/span&gt;, which crashes the host instead of escaping it.&#10;kvmCTF started a year later, but the gap is still big.&#10;Most of those kernel exploits would not work as written from a default container, because they &lt;span class="hover-tip" data-tooltip="84 of the 119 exploit folders create a user namespace, which gives a normal process root&amp;#39;s powers over its own set of namespaces and opens up kernel code it could not reach otherwise. Docker&amp;#39;s default seccomp profile blocks that unless the container has the CAP_SYS_ADMIN capability." tabindex="0"&gt;first use a feature Docker blocks&lt;/span&gt;.&#10;Still, they show how many exploitable bugs sit behind the syscalls.&lt;/p&gt;&#10;&lt;h2 id="kata-containers-and-gvisor"&gt;Kata Containers and gVisor &lt;a class="anchor" href="#kata-containers-and-gvisor" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Regular VMs are heavy.&#10;They boot a full operating system and tend to use a lot of memory.&#10;A microVM is a stripped-down VM meant to run one workload and start quickly.&#10;That still leaves a practical problem.&#10;MindRoom, like most tools, speaks Docker: it hands Docker an image and some folders to mount, and gets a running container back.&#10;A VM does not take a Docker image.&#10;Switching to VMs would normally mean building disk images, booting them, and wiring up files and networking myself.&lt;/p&gt;&#10;&lt;p&gt;Docker does not start containers by itself, though.&#10;It takes care of images, networks, and volumes, and then hands the actual start to a small program called a runtime.&#10;The default runtime, &lt;code&gt;runc&lt;/code&gt;, does what I described earlier: it starts a process on the host kernel with namespaces, cgroups, and seccomp.&#10;But you can tell Docker to use a different runtime.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://katacontainers.io" target="_blank" rel="noopener"&gt;Kata Containers&lt;/a&gt; is such a runtime, and it starts a microVM instead.&#10;It picks one of the VMMs above (my test used QEMU), boots a small guest kernel, and starts the container inside it.&lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt;&#10;Docker, and MindRoom, still see an ordinary container.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://gvisor.dev" target="_blank" rel="noopener"&gt;gVisor&lt;/a&gt;, from Google, takes a different route, and it is not a VM.&#10;It is a reimplementation of the Linux kernel, written in Go, that runs as a normal program on the host.&#10;Go manages memory for the programmer, so the use-after-free mistake behind the DepthFirst escape is much harder to make in gVisor.&#10;The worker&amp;rsquo;s syscalls go to gVisor instead of the host kernel, and gVisor itself only makes a small, filtered set of host syscalls.&#10;That is the hardening idea taken all the way: gVisor answers the agent&amp;rsquo;s syscalls itself, so the filter on the host can be much stricter than Docker&amp;rsquo;s.&#10;It needs no &lt;code&gt;/dev/kvm&lt;/code&gt;, so it also runs inside cloud VMs that cannot start VMs of their own.&lt;sup id="fnref:5"&gt;&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref"&gt;5&lt;/a&gt;&lt;/sup&gt;&#10;My test machine, an ARM server (with the kind of chip phones use) running NixOS, had no &lt;code&gt;/dev/kvm&lt;/code&gt;, which is why I tried gVisor first.&#10;Its runtime is called &lt;code&gt;runsc&lt;/code&gt;, and it plugs into Docker the same way.&lt;/p&gt;&#10;&lt;figure id="figure-the-three-options-side-by-side"&gt;&lt;img src="https://www.nijho.lt/post/kernels-containers-vms/isolation-stacks.svg" alt="Three stacks side by side. Plain Docker: the agent&amp;#39;s code makes syscalls straight into the host kernel, so the usual way out is a host kernel bug, reached through any syscall seccomp allows. gVisor: the agent&amp;#39;s code makes syscalls into gVisor&amp;#39;s own kernel, written in Go, which makes a small set of syscalls to the host kernel, so the usual way out is a gVisor bug and then a host kernel bug. Kata Containers: the agent&amp;#39;s code runs on a guest kernel inside a microVM, and the CPU runs that guest kernel directly, next to the host kernel instead of on top of it. When the guest needs a device, a VM exit hands control to the KVM module in the host kernel, which passes the request up to the VMM, a normal program on the host that fakes the device. The VMM and KVM together are the hypervisor, so the usual way out is a guest kernel bug and then a hypervisor bug." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;The three options side by side.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;p&gt;Or as a table:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Isolation&lt;/th&gt;&#10;&lt;th&gt;What worker code talks to&lt;/th&gt;&#10;&lt;th&gt;Needs KVM&lt;/th&gt;&#10;&lt;th&gt;Usual escape route&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Plain Docker (&lt;code&gt;runc&lt;/code&gt;)&lt;/td&gt;&#10;&lt;td&gt;The host kernel, filtered by seccomp&lt;/td&gt;&#10;&lt;td&gt;No&lt;/td&gt;&#10;&lt;td&gt;A host kernel bug&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;gVisor (&lt;code&gt;runsc&lt;/code&gt;)&lt;/td&gt;&#10;&lt;td&gt;gVisor&amp;rsquo;s own kernel, written in Go&lt;/td&gt;&#10;&lt;td&gt;No&lt;/td&gt;&#10;&lt;td&gt;A gVisor bug, then a host kernel bug through its small filtered surface&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Kata Containers&lt;/td&gt;&#10;&lt;td&gt;Its own guest kernel in a microVM&lt;/td&gt;&#10;&lt;td&gt;Yes&lt;/td&gt;&#10;&lt;td&gt;A guest kernel bug, then a hypervisor bug&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Each option also changes how much code on the host an escape can pick its bug from.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Lines of code on the host that deal with what the agent&amp;rsquo;s code asks for, counted with tokei, comments and blank lines included. For Docker, the core of Linux without drivers; for gVisor, its kernel and network stack without tests; for Kata, KVM alone, without the VMM and Kata&amp;rsquo;s other helpers. Not all of it is reachable. Hover for exact numbers." data-plot-module="/post/kernels-containers-vms/plots.js" data-plot-name="attackSurface"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Lines of code on the host that deal with what the agent&amp;rsquo;s code asks for, counted with tokei, comments and blank lines included. For Docker, the core of Linux without drivers; for gVisor, its kernel and network stack without tests; for Kata, KVM alone, without the VMM and Kata&amp;rsquo;s other helpers. Not all of it is reachable. Hover for exact numbers.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;h2 id="the-pr-six-lines"&gt;The PR: six lines &lt;a class="anchor" href="#the-pr-six-lines" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The change is &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2886" target="_blank" rel="noopener"&gt;PR #2886&lt;/a&gt;, which is now merged.&#10;It adds one setting, &lt;code&gt;MINDROOM_DOCKER_WORKER_RUNTIME&lt;/code&gt;, and MindRoom passes its value to Docker as the runtime whenever it starts a worker.&#10;That is &lt;span class="hover-tip" data-tooltip="Three lines in docker.py and three in docker_config.py. The merged PR adds 98 lines: these 6, 62 lines of tests, and 30 lines of docs." tabindex="0"&gt;six lines of source code&lt;/span&gt;, plus 62 lines of tests and some docs.&#10;Changing the setting recreates each worker the next time it is used, and leaving it unset keeps everything as it was.&lt;/p&gt;&#10;&lt;p&gt;For gVisor, setting it up is two steps: register the runtime in Docker&amp;rsquo;s &lt;code&gt;/etc/docker/daemon.json&lt;/code&gt; and restart Docker, then point MindRoom at it.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;runtimes&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;runsc&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nt"&gt;&amp;#34;path&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/usr/local/bin/runsc&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;MINDROOM_DOCKER_WORKER_RUNTIME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;runsc&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Kata needs no entry in that file: once it is installed, &lt;code&gt;MINDROOM_DOCKER_WORKER_RUNTIME=io.containerd.kata.v2&lt;/code&gt; is enough.&#10;The full setup, and a few catches for each runtime, are in the &lt;a href="https://docs.mindroom.chat/deployment/sandbox-proxy/#security-considerations" target="_blank" rel="noopener"&gt;MindRoom docs&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;The six lines are short because everything else already existed.&#10;gVisor and Kata do the isolating.&#10;Docker already gives each worker its folders, its credentials, and its network, and it already knows how to hand a container to a different runtime.&#10;On the MindRoom side, the hard part happened months earlier, when agent tools moved out of the main process into dedicated workers with explicit mounts and credentials.&#10;Once every worker is a single call to Docker&amp;rsquo;s &lt;code&gt;containers.run&lt;/code&gt;, swapping what runs underneath it is one argument.&#10;For comparison, Claude Opus estimated that building a microVM backend into MindRoom itself would take &lt;span class="hover-tip" data-tooltip="For a native Cloud Hypervisor backend that rebuilds image conversion, guest init, folder sharing, networking, and VM supervision. The estimate is in the PR description." tabindex="0"&gt;2,500 to 4,000 lines&lt;/span&gt;.&lt;/p&gt;&#10;&lt;h2 id="what-it-costs"&gt;What it costs &lt;a class="anchor" href="#what-it-costs" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I tested both runtimes with a real agent in a Matrix room: gVisor on that ARM server, and Kata &lt;span class="hover-tip" data-tooltip="Kata 4.2 with QEMU and Docker 29.9, inside an Incus VM with nested KVM on my desktop&amp;#39;s Ryzen 9 3900X." tabindex="0"&gt;in a throwaway VM on my desktop&lt;/span&gt;.&#10;Shell, Python, git, background processes, and the browser all worked, without any MindRoom code change.&#10;My Kata numbers below come from a VM inside a VM, so bare-metal numbers will differ.&lt;/p&gt;&#10;&lt;p&gt;Configuration is the cheap part: one environment variable, plus one entry in Docker&amp;rsquo;s config for gVisor.&#10;The other costs are the usual trade-offs between containers and VMs:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Computation.&lt;/strong&gt; Code that only calculates, without asking the kernel for anything, runs at full speed with both. gVisor lets those instructions run directly on the CPU, according to its &lt;a href="https://gvisor.dev/docs/architecture_guide/performance/" target="_blank" rel="noopener"&gt;performance guide&lt;/a&gt;. A Kata guest runs on the CPU in its virtualization mode, and in &lt;a href="https://www.usenix.org/conference/nsdi20/presentation/agache" target="_blank" rel="noopener"&gt;AWS&amp;rsquo;s paper on Firecracker&lt;/a&gt;, the CPU overhead was &lt;span class="hover-tip" data-tooltip="The paper reports memory overhead as low as 3% and negligible CPU overhead." tabindex="0"&gt;negligible&lt;/span&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Syscalls, disk, and network.&lt;/strong&gt; The cost starts when a program does ask the kernel for something. Under gVisor, every syscall takes a detour through gVisor&amp;rsquo;s kernel, so programs that make many small syscalls, like ones that open thousands of small files, slow down the most. Under Kata, disk and network go through the VMM&amp;rsquo;s fake devices. In that same paper from 2020, a Firecracker guest reached &lt;span class="hover-tip" data-tooltip="iperf3 over a tap device on an EC2 m5d.metal host, one stream: 44.1 Gbit/s for the host, 15.6 for Firecracker, and 23.8 for QEMU." tabindex="0"&gt;15 Gbit/s of network traffic where the host reached 44&lt;/span&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Startup.&lt;/strong&gt; gVisor only has to start a program, so it starts quickly. Kata has to boot a kernel first, and my worker took &lt;span class="hover-tip" data-tooltip="From creating the container until the worker answered its health check, three runs each: 10.1 to 10.9 seconds with Kata, 2.4 to 3.3 with runc." tabindex="0"&gt;about 10 seconds to start instead of about 3&lt;/span&gt;. Booting a VM can be much faster than that: &lt;a href="https://firecracker-microvm.github.io" target="_blank" rel="noopener"&gt;Firecracker&lt;/a&gt; boots a minimal one in about 125 ms.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Memory.&lt;/strong&gt; gVisor adds a &lt;span class="hover-tip" data-tooltip="gVisor&amp;#39;s performance guide: the sandbox itself is responsible for a small, mostly fixed amount of memory overhead." tabindex="0"&gt;small, mostly fixed amount&lt;/span&gt; per sandbox. Each Kata VM runs a second kernel plus the VMM, which alone takes &lt;span class="hover-tip" data-tooltip="Figure 7 of the Firecracker paper: memory used by the VMM process on top of the guest&amp;#39;s own memory, about 3 MB for Firecracker, 13 MB for Cloud Hypervisor, and 131 MB for QEMU." tabindex="0"&gt;about 3 MB with Firecracker and 131 MB with QEMU&lt;/span&gt;. Kata gives each worker VM &lt;span class="hover-tip" data-tooltip="Kata&amp;#39;s default VM has 1 vCPU and 2 GiB, set by default_vcpus and default_memory in its configuration file. Kata adds a container&amp;#39;s memory limit on top, but MindRoom sets none for its workers. The worker&amp;#39;s 1 GiB /tmp counts against it." tabindex="0"&gt;2 GiB by default&lt;/span&gt;, and &lt;code&gt;/tmp&lt;/code&gt; lives in that RAM. The host only hands out memory the guest actually touches, so my idle worker used &lt;span class="hover-tip" data-tooltip="QEMU used 530 to 616 MiB and virtiofsd, which shares the folders, about 160 MiB for one idle worker VM. Both map the guest&amp;#39;s memory, so some pages count twice and the real total is lower." tabindex="0"&gt;under 0.8 GiB&lt;/span&gt; of host memory. Raising the VM size &lt;span class="hover-tip" data-tooltip="The guest kernel keeps 64 bytes of bookkeeping for every 4 KiB page, about 1.6% of the VM&amp;#39;s size, so an 8 GiB VM costs about 128 MiB up front." tabindex="0"&gt;costs little&lt;/span&gt; until a worker needs it. But a VM cannot grow past its size the way a container can, and memory the guest has used, for example to keep recently read files in its cache, &lt;span class="hover-tip" data-tooltip="Kata&amp;#39;s reclaim_guest_freed_memory option, off by default, returns pages the guest frees. File cache does not count as free, so it stays." tabindex="0"&gt;mostly stays with the VM&lt;/span&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Compatibility.&lt;/strong&gt; gVisor reimplements Linux, and its &lt;a href="https://gvisor.dev/docs/user_guide/compatibility/" target="_blank" rel="noopener"&gt;docs&lt;/a&gt; say there will always be unimplemented features and bugs, so now and then a program will not work. Kata runs a real Linux kernel, so programs behave as usual, with a few catches. For example, a file lock held on the host does not block the worker, because the lock lives in the guest kernel.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="what-this-does-not-fix"&gt;What this does not fix &lt;a class="anchor" href="#what-this-does-not-fix" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A stronger sandbox protects the host.&#10;It does nothing about the tokens and network access you give the worker.&#10;An agent needs no kernel exploit to misuse a token that can push to your repositories, or to poke at every device on your home network.&#10;Scoped credentials and a firewall allowlist protect you at least as much, and MindRoom handles both separately: &lt;a href="https://docs.mindroom.chat/deployment/egress-broker/" target="_blank" rel="noopener"&gt;Agent Keys&lt;/a&gt; let agents use API keys without ever seeing them, and &lt;a href="https://docs.mindroom.chat/deployment/approved-egress/" target="_blank" rel="noopener"&gt;Approved Egress&lt;/a&gt; limits which servers a worker on Kubernetes can reach.&lt;/p&gt;&#10;&lt;p&gt;gVisor has had its own bugs, and it still talks to the host kernel, just through a much smaller door.&#10;KVM has bugs too, as this year&amp;rsquo;s escapes show.&#10;Both walls make an escape far harder, and neither makes it impossible.&lt;/p&gt;&#10;&lt;h2 id="conclusion"&gt;Conclusion &lt;a class="anchor" href="#conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Once I started reading about this, I kept running into people saying containers were never a security boundary.&#10;That is true, and for years I did not worry about it.&#10;With AI finding kernel bugs faster and agents running code nobody reads, I do now.&lt;/p&gt;&#10;&lt;p&gt;No sandbox is perfectly safe, though.&#10;In &lt;a href="https://www.dwarkesh.com/p/noam-brown" target="_blank" rel="noopener"&gt;a conversation with Dwarkesh Patel&lt;/a&gt;, Noam Brown doubted that even computers with no network connection at all would be enough to contain an AI.&#10;He pointed to &lt;a href="https://arxiv.org/abs/1503.07919" target="_blank" rel="noopener"&gt;studies&lt;/a&gt; where two such computers next to each other &lt;span class="hover-tip" data-tooltip="BitWhisper, from Ben-Gurion University in 2015: 1 to 8 bits per hour between computers up to 40 cm apart, enough for a short command or a password." tabindex="0"&gt;talk through heat&lt;/span&gt;: one runs its CPU hot, and the other picks up the change with its temperature sensor.&#10;Every option in this post trades some speed or memory for safety.&#10;How far to go depends on your own risk tolerance and how paranoid you are.&#10;MindRoom can now move its agents off the shared kernel with one environment variable.&#10;I do not use it myself yet, but if you are more paranoid than I am, it is there.&lt;/p&gt;&#10;&lt;div class="footnotes" role="doc-endnotes"&gt;&#10;&lt;hr&gt;&#10;&lt;ol&gt;&#10;&lt;li id="fn:1"&gt;&#10;&lt;p&gt;The other way out is a bug in the program that starts the container. In 2024, &lt;a href="https://github.com/opencontainers/runc/security/advisories/GHSA-xr7r-f8xq-vfvv" target="_blank" rel="noopener"&gt;CVE-2024-21626&lt;/a&gt; in runc, the program Docker uses for that, leaked a handle to a host folder into new containers, so a malicious image could reach the host&amp;rsquo;s files without any kernel bug.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:2"&gt;&#10;&lt;p&gt;Docker can map the container&amp;rsquo;s root to an ordinary user on the host with &lt;a href="https://docs.docker.com/engine/security/userns-remap/" target="_blank" rel="noopener"&gt;user namespace remapping&lt;/a&gt;, or run without root altogether in &lt;a href="https://docs.docker.com/engine/security/rootless/" target="_blank" rel="noopener"&gt;rootless mode&lt;/a&gt;, but neither is the default. Rootless mode would have stopped the agent in my Docker story, because Docker then has only my own rights. Remapping would not, because anyone who can use Docker can turn it off for a single container. Neither helps against a kernel bug, because code running inside the kernel is above every user.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:3"&gt;&#10;&lt;p&gt;A bug in the VMM&amp;rsquo;s fake devices, or in other VMM code that handles the guest&amp;rsquo;s traffic, can skip the first step, because a normal program in the guest can feed that code data through the network or a shared folder. &lt;a href="https://access.redhat.com/security/cve/cve-2020-8608" target="_blank" rel="noopener"&gt;CVE-2020-8608&lt;/a&gt;, a buffer overflow in QEMU&amp;rsquo;s user-mode networking, could be triggered that way with crafted network traffic.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:4"&gt;&#10;&lt;p&gt;Like runc for Docker, Kata&amp;rsquo;s own programs on the host are a way out too. In 2020, one bug (&lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2020-2023" target="_blank" rel="noopener"&gt;CVE-2020-2023&lt;/a&gt;) let a container take over the guest without a kernel bug, and a second (&lt;a href="https://nvd.nist.gov/vuln/detail/CVE-2020-2026" target="_blank" rel="noopener"&gt;CVE-2020-2026&lt;/a&gt;) then let the guest trick the Kata runtime on the host into mounting files over any host path. Neither needed a KVM bug. virtiofsd, the program that shares folders with the guest, also runs on the host and handles the guest&amp;rsquo;s file requests.&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:5"&gt;&#10;&lt;p&gt;gVisor can &lt;a href="https://gvisor.dev/docs/architecture_guide/platforms/" target="_blank" rel="noopener"&gt;use KVM too&lt;/a&gt;, as an option. By default it catches the agent&amp;rsquo;s syscalls without it, which is the setup this post describes. With KVM switched on, gVisor runs the agent&amp;rsquo;s code in the CPU&amp;rsquo;s virtualization mode so catching syscalls is faster, but gVisor&amp;rsquo;s own kernel still answers them, and there is no guest Linux and no fake devices. gVisor recommends that mode only on bare metal; inside a VM the default is usually faster.&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/div&gt;&#10;</description></item><item><title>Giving models the tools they were trained with can make them worse</title><link>https://www.nijho.lt/post/native-harness-tools/</link><pubDate>Sun, 11 Oct 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/native-harness-tools/</guid><description>&lt;p&gt;A few nights ago, lying in bed, I had what felt like a galaxy-brain idea.&#10;I dictated it into my watch so I would still remember it in the morning.&lt;/p&gt;&#10;&lt;p&gt;Every frontier model learns to solve coding tasks with tools through reinforcement learning (RL), and I assume that training happens inside its vendor&amp;rsquo;s own coding agent: Anthropic&amp;rsquo;s models in Claude Code, and OpenAI&amp;rsquo;s models in Codex.&#10;That is a big assumption, since the labs do not publish their training environments, but it makes business sense: they sell those agents, so they have every reason to make their models work best in them.&#10;Every other harness, like &lt;a href="https://github.com/badlogic/pi-mono" target="_blank" rel="noopener"&gt;pi&lt;/a&gt;, &lt;a href="https://opencode.ai/" target="_blank" rel="noopener"&gt;opencode&lt;/a&gt;, or my own &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom&lt;/a&gt;, gives the model a set of tools of its own design for running commands and editing files.&#10;The models are usually smart enough to figure those out, but not always.&#10;Sometimes a model assumes an edit tool works like the one it was trained with, and uses it wrong.&#10;This summer, that happened to Claude Opus 4.8 in pi, which I come back to &lt;a href="#why-i-believed-it"&gt;below&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;So the idea was simple: in MindRoom, give each model the same shell and file-editing tools as its native harness, and switch them automatically depending on which model is answering.&#10;Claude would see Claude Code&amp;rsquo;s &lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;Read&lt;/code&gt;, &lt;code&gt;Edit&lt;/code&gt;, and &lt;code&gt;Write&lt;/code&gt;.&#10;GPT would see Codex&amp;rsquo;s &lt;code&gt;exec_command&lt;/code&gt; and &lt;code&gt;apply_patch&lt;/code&gt;.&#10;And because the smallest agents do surprisingly well, I would go one step further: a minimal agent whose only tool is the shell each model knows from its training.&lt;/p&gt;&#10;&lt;p&gt;I was beyond excited.&#10;I could not really share that excitement locally, because my wife did not care, so I am sharing it with the internet instead.&lt;/p&gt;&#10;&lt;p&gt;Then I measured it against MindRoom&amp;rsquo;s own tools, and the familiar ones did not make the models more efficient.&#10;With only Codex&amp;rsquo;s tools, GPT-6 Astra did 84% more work, taking more steps and reading and writing more along the way, and used 59% more tokens.&#10;With Claude Code&amp;rsquo;s tools, Claude Sonnet 5.5 did 15% more work, and Claude only came out a few tokens cheaper because the descriptions I wrote for those tools are slightly shorter than MindRoom&amp;rsquo;s.&#10;Only one model clearly worked more efficiently with its own tools: Claude Opus 4.8, the model from the pi story.&#10;The models seem to generalize beyond the environment they were trained in, and what still matters is how much the agent sends with every request.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;What I found&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Compared with MindRoom&amp;rsquo;s own tools, the familiar ones did not make the models more efficient: with only Codex&amp;rsquo;s tools, GPT-6 Astra and Sol did 60 to 84% more work and used 43 to 59% more tokens.&lt;/li&gt;&#10;&lt;li&gt;With Claude Code&amp;rsquo;s tools, Claude Sonnet 5.5 did 15% more work and Opus 5.5 about the same; they only came out a few tokens cheaper because the descriptions I wrote for those tools are shorter than MindRoom&amp;rsquo;s.&lt;/li&gt;&#10;&lt;li&gt;Only Claude Opus 4.8, the model whose edits kept failing in pi, clearly worked more efficiently with its own tools.&lt;/li&gt;&#10;&lt;li&gt;What matters is how much the agent sends with every request: a minimal agent with one shell tool and a 12-line prompt used 58 to 76% fewer tokens than the same agent in standard mode on these short tasks.&lt;/li&gt;&#10;&lt;li&gt;Giving that minimal agent each model&amp;rsquo;s own shell tool did not make it better.&lt;/li&gt;&#10;&lt;/ul&gt;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#what-a-harness-is"&gt;What a harness is&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-i-believed-it"&gt;Why I believed it&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#smaller-agents-do-better"&gt;Smaller agents do better&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#models-should-know-their-own-tools-best"&gt;Models should know their own tools best&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-i-built"&gt;What I built&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#how-i-measured-it"&gt;How I measured it&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#native-tools-dont-make-todays-models-more-efficient"&gt;Native tools don&amp;rsquo;t make today&amp;rsquo;s models more efficient&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#older-models-only-opus-48-did-better-with-them"&gt;Older models: only Opus 4.8 did better with them&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-does-matter-what-the-agent-sends"&gt;What does matter: what the agent sends&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#fewer-tools"&gt;Fewer tools&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#minimal-mode-one-shell-tool-and-a-12-line-prompt"&gt;Minimal mode: one shell tool and a 12-line prompt&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#minimal-mode-with-each-models-native-shell-tool"&gt;Minimal mode with each model&amp;rsquo;s native shell tool&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-this-does-and-does-not-show"&gt;What this does and does not show&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-happens-to-the-pull-request"&gt;What happens to the pull request&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-this-excites-me"&gt;Why this excites me&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#appendix-how-i-measured-and-the-numbers-behind-the-charts"&gt;Appendix: how I measured, and the numbers behind the charts&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="what-a-harness-is"&gt;What a harness is &lt;a class="anchor" href="#what-a-harness-is" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&amp;ldquo;Harness&amp;rdquo; gets thrown around a lot, but there is no magic in it.&#10;Every coding agent talks to the model the same way: each request contains a system prompt, the definition of every tool the model may call, and the conversation so far.&#10;When the model answers with a tool call, the harness runs the tool, adds the result to the conversation, and sends everything again.&lt;/p&gt;&#10;&lt;figure class="harness-diagram" style="max-width: 460px; margin: 2rem auto;"&gt;&#10;&lt;svg viewBox="0 0 380 470" role="img" aria-label="One request holds the system prompt, the tool definitions, and the conversation so far. The model answers with a tool call, the harness runs it, adds the result to the conversation, and sends the whole request again." style="width: 100%; height: auto; font-family: system-ui, sans-serif;"&gt;&#10;&lt;defs&gt;&lt;marker id="harness-arrow" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="7" markerHeight="7" orient="auto-start-reverse"&gt;&lt;path d="M0,0 L8,4 L0,8 z" fill="currentColor"/&gt;&lt;/marker&gt;&lt;/defs&gt;&#10;&lt;rect x="10" y="10" width="250" height="210" rx="10" fill="none" stroke="currentColor" stroke-opacity="0.45"/&gt;&#10;&lt;text x="22" y="32" font-size="14" font-weight="700" fill="currentColor"&gt;One request to the model&lt;/text&gt;&#10;&lt;rect x="22" y="44" width="226" height="48" rx="6" fill="#97bbf5" fill-opacity="0.45"/&gt;&#10;&lt;text x="34" y="64" font-size="13" font-weight="600" fill="currentColor"&gt;System prompt&lt;/text&gt;&#10;&lt;text x="34" y="81" font-size="11" fill="currentColor" fill-opacity="0.8"&gt;who the agent is, how it should work&lt;/text&gt;&#10;&lt;rect x="22" y="100" width="226" height="48" rx="6" fill="#97bbf5" fill-opacity="0.45"/&gt;&#10;&lt;text x="34" y="120" font-size="13" font-weight="600" fill="currentColor"&gt;Tool definitions&lt;/text&gt;&#10;&lt;text x="34" y="137" font-size="11" fill="currentColor" fill-opacity="0.8"&gt;name, description, and arguments&lt;/text&gt;&#10;&lt;rect x="22" y="156" width="226" height="52" rx="6" fill="#4269d0" fill-opacity="0.35"/&gt;&#10;&lt;text x="34" y="177" font-size="13" font-weight="600" fill="currentColor"&gt;Conversation so far&lt;/text&gt;&#10;&lt;text x="34" y="194" font-size="11" fill="currentColor" fill-opacity="0.8"&gt;the task, every tool call, every result&lt;/text&gt;&#10;&lt;path d="M268 46 h6 v100 h-6" fill="none" stroke="currentColor" stroke-opacity="0.6"/&gt;&#10;&lt;text x="281" y="88" font-size="11" fill="currentColor"&gt;the same on&lt;/text&gt;&#10;&lt;text x="281" y="102" font-size="11" fill="currentColor"&gt;every request&lt;/text&gt;&#10;&lt;path d="M268 158 h6 v48 h-6" fill="none" stroke="currentColor" stroke-opacity="0.6"/&gt;&#10;&lt;text x="281" y="170" font-size="11" fill="currentColor"&gt;grows with&lt;/text&gt;&#10;&lt;text x="281" y="184" font-size="11" fill="currentColor"&gt;every step&lt;/text&gt;&#10;&lt;line x1="135" y1="220" x2="135" y2="246" stroke="currentColor" marker-end="url(#harness-arrow)"/&gt;&#10;&lt;rect x="85" y="250" width="100" height="40" rx="20" fill="currentColor" fill-opacity="0.1" stroke="currentColor" stroke-opacity="0.45"/&gt;&#10;&lt;text x="135" y="275" font-size="13" font-weight="700" text-anchor="middle" fill="currentColor"&gt;Model&lt;/text&gt;&#10;&lt;line x1="186" y1="270" x2="214" y2="270" stroke="currentColor" stroke-opacity="0.6" marker-end="url(#harness-arrow)"/&gt;&#10;&lt;text x="220" y="274" font-size="11" fill="currentColor" fill-opacity="0.8"&gt;or a final answer&lt;/text&gt;&#10;&lt;line x1="135" y1="290" x2="135" y2="318" stroke="currentColor" marker-end="url(#harness-arrow)"/&gt;&#10;&lt;rect x="35" y="322" width="200" height="46" rx="6" fill="none" stroke="currentColor" stroke-opacity="0.45"/&gt;&#10;&lt;text x="47" y="341" font-size="13" font-weight="600" fill="currentColor"&gt;A tool call&lt;/text&gt;&#10;&lt;text x="47" y="358" font-size="11" fill="currentColor" fill-opacity="0.8" font-family="ui-monospace, monospace"&gt;Bash: ls data/&lt;/text&gt;&#10;&lt;line x1="135" y1="368" x2="135" y2="394" stroke="currentColor" marker-end="url(#harness-arrow)"/&gt;&#10;&lt;rect x="35" y="398" width="200" height="46" rx="6" fill="none" stroke="currentColor" stroke-opacity="0.45"/&gt;&#10;&lt;text x="47" y="417" font-size="13" font-weight="600" fill="currentColor"&gt;The harness runs it&lt;/text&gt;&#10;&lt;text x="47" y="434" font-size="11" fill="currentColor" fill-opacity="0.8"&gt;and adds the result&lt;/text&gt;&#10;&lt;path d="M235 421 H355 V199 H264" fill="none" stroke="currentColor" stroke-dasharray="4 3" marker-end="url(#harness-arrow)"/&gt;&#10;&lt;text x="347" y="300" font-size="11" fill="currentColor" text-anchor="middle" transform="rotate(-90 347 300)"&gt;sent again, all of it&lt;/text&gt;&#10;&lt;/svg&gt;&#10;&lt;figcaption&gt;What a coding agent sends with every step. The light parts are the same every time; only the conversation grows.&lt;/figcaption&gt;&#10;&lt;/figure&gt;&#10;&lt;p&gt;So from the model&amp;rsquo;s side, a harness is three things: its system prompt, its tool definitions, and what comes back when a tool runs.&#10;The first two are just text, so they are easy to copy, and the tool definitions are effectively the harness&amp;rsquo;s API: change them, and the model sees a different harness.&#10;The third is code, which takes more work to copy.&lt;/p&gt;&#10;&lt;p&gt;Because every request resends everything, a task&amp;rsquo;s tokens come in two parts.&#10;The fixed part is what the agent sends before anything happens: its system prompt, its tool definitions, and the task, which every request resends.&#10;The work is everything the steps add on top: the model&amp;rsquo;s replies, the tool results, and the growing conversation that every later request resends too.&#10;When I say below that a model did more work, I mean that second part.&lt;/p&gt;&#10;&lt;h2 id="why-i-believed-it"&gt;Why I believed it &lt;a class="anchor" href="#why-i-believed-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Two things convinced me: how well the smallest agents do, and what goes wrong when a model meets unfamiliar tools.&lt;/p&gt;&#10;&lt;h3 id="smaller-agents-do-better"&gt;Smaller agents do better &lt;a class="anchor" href="#smaller-agents-do-better" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Pi made its name by being small.&#10;When Mario Zechner &lt;a href="https://mariozechner.at/posts/2025-11-30-pi-coding-agent/" target="_blank" rel="noopener"&gt;introduced pi&lt;/a&gt; last November, its system prompt and tool definitions together came in below 1,000 tokens, and it had four tools: &lt;code&gt;read&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt;, &lt;code&gt;edit&lt;/code&gt;, and &lt;code&gt;bash&lt;/code&gt;.&#10;He also wrote that &amp;ldquo;pi does not and will not support MCP&amp;rdquo;, the Model Context Protocol through which most agents load outside tools.&#10;And he pointed to Terminus 2, a minimal agent from the Terminal-Bench team, which was &amp;ldquo;holding its own against agents with far more sophisticated tooling&amp;rdquo;.&lt;/p&gt;&#10;&lt;p&gt;In August, DeepSeek released &lt;a href="https://github.com/deepseek-ai/deepseek-harness" target="_blank" rel="noopener"&gt;DeepSeek Harness&lt;/a&gt;, which was &lt;a href="https://news.ycombinator.com/item?id=49285244" target="_blank" rel="noopener"&gt;all over Hacker News&lt;/a&gt; and the local AI subreddits I read.&#10;Its standard setup comes with a full set of tools.&#10;But for benchmarks, DeepSeek &lt;a href="https://github.com/deepseek-ai/deepseek-harness/blob/d743267388641bc76f17c45ce8b4c231aed1d32c/BENCHMARK.md" target="_blank" rel="noopener"&gt;points to its minimal profile&lt;/a&gt;.&#10;In early September, that profile had &lt;a href="https://github.com/deepseek-ai/deepseek-harness/blob/63795eaa5cba78cc0a92d95fccd8db5523d7f050/packages/bundle/sdk-minimal/README.md#L78-L84" target="_blank" rel="noopener"&gt;exactly one tool, a persistent &lt;code&gt;bash&lt;/code&gt;, and a one-line system prompt&lt;/a&gt;: &amp;ldquo;You are a helpful software engineer assistant.&amp;rdquo;&#10;(Ten days later, it already had a second tool, &lt;code&gt;working_directory&lt;/code&gt;; staying that small seems to be hard.)&#10;That is what inspired the minimal mode I added to MindRoom in September, which gives an agent a short prompt and a single &lt;code&gt;bash&lt;/code&gt; tool.&lt;/p&gt;&#10;&lt;h3 id="models-should-know-their-own-tools-best"&gt;Models should know their own tools best &lt;a class="anchor" href="#models-should-know-their-own-tools-best" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The case that got me thinking about this was Claude Opus 4.8 in pi.&#10;In July, a pi user reported that &lt;a href="https://github.com/earendil-works/pi/issues/6278" target="_blank" rel="noopener"&gt;about 20% of its edits failed in some sessions&lt;/a&gt;.&#10;Pi&amp;rsquo;s &lt;code&gt;edit&lt;/code&gt; tool takes a list of replacements, and Opus 4.8 kept adding made-up fields to them, like &lt;code&gt;in_file&lt;/code&gt;, &lt;code&gt;matchCase&lt;/code&gt;, or &lt;code&gt;newText2&lt;/code&gt;.&#10;Claude Sonnet 5 did it too, while Opus 4.7 and older Claude models never did in the same tests.&lt;/p&gt;&#10;&lt;p&gt;Armin Ronacher, one of pi&amp;rsquo;s maintainers, &lt;a href="https://github.com/earendil-works/pi/issues/6278#issuecomment-4883362982" target="_blank" rel="noopener"&gt;dug into it&lt;/a&gt; and compared it with what Claude Code does with the tool calls it receives.&#10;It turns out that Claude Code quietly repairs a lot of them:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;It accepts several names for the same argument, like &lt;code&gt;old_str&lt;/code&gt; and &lt;code&gt;old_string&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;It parses an argument that arrives as a string when it should be an object.&lt;/li&gt;&#10;&lt;li&gt;It fixes broken &lt;code&gt;\uXXXX&lt;/code&gt; escapes in strings.&lt;/li&gt;&#10;&lt;li&gt;It drops fields it does not know.&lt;/li&gt;&#10;&lt;li&gt;When it cannot parse a call at all, it asks the model to try again.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;His hypothesis is that RL itself might be the cause.&#10;If a model is trained in a harness that absorbs these mistakes, a slightly wrong tool call still completes the task and still gets rewarded, so nothing teaches the model not to make it.&#10;Pi &lt;a href="https://github.com/earendil-works/pi/commit/a1b336d73e13b53949ff629800081185d3e4694e" target="_blank" rel="noopener"&gt;now ignores unknown fields too&lt;/a&gt;, just like Claude Code.&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;Then pi itself strayed from its minimal roots.&#10;Pi 1.0 came out on October 1 and &lt;a href="https://earendil.com/posts/pi-1-0/" target="_blank" rel="noopener"&gt;added MCP after all&lt;/a&gt;.&#10;&lt;a href="https://www.theregister.com/ai-and-ml/2026/10/02/pi-coding-agent-pulls-a-180-and-adds-mcp-support/5300678" target="_blank" rel="noopener"&gt;The Register&lt;/a&gt; called it a 180.&#10;On &lt;a href="https://news.ycombinator.com/item?id=49926069" target="_blank" rel="noopener"&gt;Hacker News&lt;/a&gt; and &lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1wvffcr/pi_10_released_mcp_support_now_included_by_default/" target="_blank" rel="noopener"&gt;r/LocalLLaMA&lt;/a&gt;, people worried that &lt;a href="https://news.ycombinator.com/item?id=49926549" target="_blank" rel="noopener"&gt;&amp;ldquo;Pi&amp;rsquo;s days as a nice minimal agent TUI are numbered&amp;rdquo;&lt;/a&gt;.&#10;What struck me was how the maintainers explained it.&#10;&lt;a href="https://news.ycombinator.com/item?id=49926377" target="_blank" rel="noopener"&gt;Armin Ronacher&lt;/a&gt; wrote that the models &amp;ldquo;are trained on their respective harnesses and we&amp;rsquo;re not here to fight their behavior&amp;rdquo;, and &lt;a href="https://news.ycombinator.com/item?id=49926840" target="_blank" rel="noopener"&gt;Mario Zechner&lt;/a&gt; that &amp;ldquo;we follow what the models are trained on&amp;rdquo;.&#10;That is exactly the native-tools half of my plan.&lt;/p&gt;&#10;&lt;p&gt;My plan combined both: a minimal agent, with each model&amp;rsquo;s native shell as its only tool.&#10;Terminal-Bench also said something I chose to ignore: agents like Terminus 2 do well with tools no model was trained on.&#10;I did not believe that part.&#10;In opencode and pi, I had repeatedly seen models get the edit tool wrong, so I assumed the benchmarks did not carry over to real work.&#10;My belief that a model works best in the harness it was trained in was that strong: I expected the native tools to help, and to help most in a minimal agent with nothing but a shell.&lt;/p&gt;&#10;&lt;h2 id="what-i-built"&gt;What I built &lt;a class="anchor" href="#what-i-built" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;MindRoom is my open-source platform for AI agents that live in Matrix chat rooms, where several agents can work together.&#10;Its agents get shell and file tools under MindRoom&amp;rsquo;s own names, like &lt;code&gt;run_shell_command&lt;/code&gt;, &lt;code&gt;read_file&lt;/code&gt;, and &lt;code&gt;edit_file&lt;/code&gt;.&#10;In &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2766" target="_blank" rel="noopener"&gt;this pull request&lt;/a&gt;, I added what I call tool dialects, which show a model those tools in the shape of the coding agent it was trained in.&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Sees&lt;/th&gt;&#10;&lt;th&gt;Instead of&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;BashOutput&lt;/code&gt;, &lt;code&gt;KillShell&lt;/code&gt;, &lt;code&gt;Read&lt;/code&gt;, &lt;code&gt;Edit&lt;/code&gt;, and &lt;code&gt;Write&lt;/code&gt;, as in Claude Code&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;run_shell_command&lt;/code&gt;, &lt;code&gt;check_shell_command&lt;/code&gt;, &lt;code&gt;kill_shell_command&lt;/code&gt;, &lt;code&gt;read_file&lt;/code&gt;, &lt;code&gt;edit_file&lt;/code&gt;, and &lt;code&gt;write_file&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;exec_command&lt;/code&gt;, &lt;code&gt;write_stdin&lt;/code&gt;, and a freeform &lt;code&gt;apply_patch&lt;/code&gt; that takes the patch as plain text, as in Codex, and a &lt;code&gt;kill_shell_command&lt;/code&gt; that takes Codex&amp;rsquo;s &lt;code&gt;session_id&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;run_shell_command&lt;/code&gt;, &lt;code&gt;check_shell_command&lt;/code&gt;, &lt;code&gt;kill_shell_command&lt;/code&gt;, &lt;code&gt;edit_file&lt;/code&gt;, and &lt;code&gt;write_file&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Inside MindRoom, nothing changes: approvals, hooks, and the stored history keep MindRoom&amp;rsquo;s names, and the translation only happens on the way to and from the model.&#10;That gives MindRoom a property I like a lot: a conversation can switch from Claude to GPT halfway through, and each model sees the earlier tool calls in its own shape, as if it had made them in its own harness.&lt;/p&gt;&#10;&lt;p&gt;Matching the native harness exactly turned out to be a stretch, though.&#10;Codex has no tool for reading files, so in the pull request, GPT keeps MindRoom&amp;rsquo;s &lt;code&gt;read_file&lt;/code&gt;, and both keep MindRoom&amp;rsquo;s &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;find_files&lt;/code&gt;, and &lt;code&gt;ls&lt;/code&gt;, which makes each native set a mix.&#10;For the main comparison, I removed those extra tools, so each model saw only the tools of its own harness.&#10;The tools have the same names and arguments as in Claude Code and Codex, but I wrote short descriptions of my own, because Claude Code&amp;rsquo;s are not openly licensed.&#10;What they return is MindRoom&amp;rsquo;s output, and the system prompt is MindRoom&amp;rsquo;s too.&#10;So keep in mind for everything below: I tested the names and shapes of the tools, not the whole harness.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;How the translation works&lt;/summary&gt;&#10; &lt;ul&gt;&#10;&lt;li&gt;Codex&amp;rsquo;s &lt;code&gt;apply_patch&lt;/code&gt; is freeform: the model writes the patch as plain text instead of JSON arguments. I ported Codex&amp;rsquo;s patch parser and the code that applies patches, together with Codex&amp;rsquo;s own test cases, so a patch from a Codex-trained model applies exactly as it would in Codex. Its description comes from Codex too, which is openly licensed.&lt;/li&gt;&#10;&lt;li&gt;A switched model sees earlier calls in its own shape only for the tools its own harness also has, like the shell: an edit made with Claude Code&amp;rsquo;s &lt;code&gt;Edit&lt;/code&gt; stays an &lt;code&gt;edit_file&lt;/code&gt; call for GPT, which has no matching tool.&lt;/li&gt;&#10;&lt;li&gt;An earlier version of the pull request also rewrote every tool result to look like the native one. That was a lot of fragile code, so I removed it before I measured anything.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h2 id="how-i-measured-it"&gt;How I measured it &lt;a class="anchor" href="#how-i-measured-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I used 12 terminal tasks from an evaluation suite I built for MindRoom, like writing a report from a CSV file, finding the commit that broke a check, or fixing failing tests.&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;&#10;A hidden check graded each result, and every setup ran every task three times.&#10;Almost every run passed, so the interesting number is how many tokens the agent needed to get there, cached input included, and cheaper in what follows means fewer tokens.&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;&#10;The tool comparisons ran through MindRoom&amp;rsquo;s OpenAI-compatible API; minimal mode, which only works in chat, ran through Matrix.&#10;I tested five current models, Claude Opus 5.5 and Sonnet 5.5, and GPT-6 Astra, GPT-6.1 Sol, and GPT-6 Luna, and later &lt;a href="#older-models-only-opus-48-did-better-with-them"&gt;five older ones&lt;/a&gt;.&#10;The current Claude models ran with adaptive thinking, where the model decides when to think.&#10;I called the GPT models from MindRoom through OpenAI&amp;rsquo;s Codex backend, the endpoint the Codex CLI uses, so no run used Codex itself; with no reasoning effort set, the backend picks one.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;Details of the setup&lt;/summary&gt;&#10; &lt;ul&gt;&#10;&lt;li&gt;A small harness sent each task to MindRoom&amp;rsquo;s OpenAI-compatible API as a new conversation, and a hidden check graded the result in a separate container without network access. Every task ran three times per configuration, so each number in this post comes from 36 runs.&lt;/li&gt;&#10;&lt;li&gt;The agent&amp;rsquo;s commands ran in a Docker container, the way MindRoom runs agents it does not fully trust.&lt;/li&gt;&#10;&lt;li&gt;With adaptive thinking, the current Claude models thought before 15 to 25% of their replies, with MindRoom&amp;rsquo;s tools and with the native ones.&lt;/li&gt;&#10;&lt;li&gt;I ran the GPT models through OpenAI&amp;rsquo;s Codex backend, the endpoint the Codex CLI uses, and sent no reasoning effort, so the backend picked one. The GPT-6 models barely reasoned on these tasks: in those runs, only 4 to 12% of their requests had any reasoning tokens, and then 7 to 234 of them.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h2 id="native-tools-dont-make-todays-models-more-efficient"&gt;Native tools don&amp;rsquo;t make today&amp;rsquo;s models more efficient &lt;a class="anchor" href="#native-tools-dont-make-todays-models-more-efficient" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;To make the comparison fair, I gave each model only the tools of its own harness, against MindRoom&amp;rsquo;s matching set.&lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt;&#10;For Claude, that is a shell and tools to read, edit, and write files; for GPT, a shell and Codex&amp;rsquo;s &lt;code&gt;apply_patch&lt;/code&gt;, against MindRoom&amp;rsquo;s tools to edit and write files.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with only the harness&amp;rsquo;s own tools against MindRoom&amp;rsquo;s matching set, and with the mixed set in the pull request. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="fairCurrent"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with only the harness&amp;rsquo;s own tools against MindRoom&amp;rsquo;s matching set, and with the mixed set in the pull request. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;Claude got 6 to 13% cheaper with Claude Code&amp;rsquo;s tools, but only because the definitions I wrote for them are about 480 tokens shorter than MindRoom&amp;rsquo;s, and every request resends them; the tools themselves saved nothing, and Sonnet 5.5 even did 15% more work with them.&#10;It never even touched the file tools: Opus 5.5 and Sonnet 5.5 did everything in the shell, with either set.&lt;/p&gt;&#10;&lt;p&gt;GPT-6 Astra and Sol got much more expensive, while Luna barely changed.&#10;With only Codex&amp;rsquo;s tools, GPT-6 Astra did 84% more work and used 59% more tokens.&#10;It called &lt;code&gt;apply_patch&lt;/code&gt; 30 times, as a separate step for edits it otherwise made inside its shell commands, and every extra step resends the whole conversation so far.&#10;I expected the opposite: these are the tools I assumed these models were trained on, so I thought they would need fewer and more confident steps.&#10;The mixed set, the lighter rows, points the same way.&lt;/p&gt;&#10;&lt;p&gt;The tool mistakes I wanted to prevent did not happen with MindRoom&amp;rsquo;s tools at all: with its matching set, none of the five models made a single tool error.&#10;The only errors came from the mixed set: next to Codex&amp;rsquo;s tools, Luna had to guess how MindRoom&amp;rsquo;s &lt;code&gt;read_file&lt;/code&gt; resolves paths, and got it wrong seven times.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;The numbers behind this section&lt;/summary&gt;&#10; &lt;p&gt;&lt;strong&gt;Fixed part and work.&lt;/strong&gt;&#10;Every request to a model sends the whole conversation so far, plus the definition of every tool the model can use.&#10;So I split each task&amp;rsquo;s tokens in two.&#10;The fixed part is the first request&amp;rsquo;s input, which holds the system prompt, the tool definitions, and the task, times the number of requests.&#10;The work is everything else: tool results and the model&amp;rsquo;s replies, counted again with every later request that resends them, so it also grows with the number of steps.&#10;Providers cache most of the fixed part between requests and charge much less for cached input, so it costs less than its share of the tokens suggests.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Only the harness&amp;rsquo;s own tools.&lt;/strong&gt;&#10;With Claude Code&amp;rsquo;s tools, Opus 5.5 used 13% fewer tokens [95% CI −19 to −6%] and Sonnet 5.5 6% fewer [−10 to −1%].&#10;Both came from the definitions: the Claude Code-style set I wrote is about 480 tokens shorter, while the work on top of it grew by 7% [−7 to +23%] and 15% [+7 to +25%].&#10;With Codex&amp;rsquo;s tools, GPT-6 Astra used 59% more tokens [+53 to +65%] and GPT-6.1 Sol 43% more [+33 to +52%].&#10;They called &lt;code&gt;apply_patch&lt;/code&gt; 30 and 22 times, where with MindRoom&amp;rsquo;s tools they made only 3 and 6 calls to the file tools, so they needed 4.7 and 4.4 requests per task instead of 3.5 and 3.6 and did 84% [+73 to +96%] and 60% [+44 to +76%] more work.&#10;GPT-6 Luna used about the same with either set, +3% [−8 to +15%], and called &lt;code&gt;apply_patch&lt;/code&gt; only 8 times.&#10;The pass rates stayed within one or two runs of each other, and no model made a tool error with either set.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The mixed set, as it is in the pull request.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals. The second row caps the native shell output at the last 100 lines, MindRoom&amp;rsquo;s shell default. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="nativeDelta"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals. The second row caps the native shell output at the last 100 lines, MindRoom&amp;rsquo;s shell default. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;With Claude Code&amp;rsquo;s tools, both Claude models used about 9% fewer tokens.&#10;With Codex&amp;rsquo;s tools, GPT-6 Astra used 31% more tokens and GPT-6.1 Sol 19% more.&#10;An earlier run of the same experiment, before some unrelated fixes in the pull request, gave almost the same numbers: 33% more for Astra and 15% more for Sol.&#10;For GPT-6 Luna, the difference was too small to tell apart from noise.&#10;The pass rates barely moved: Opus, Sonnet, and Sol passed all 36 runs with either set of tools, and Astra failed one run in some configurations.&#10;Luna passed 33 runs with MindRoom&amp;rsquo;s tools and 35 with Codex&amp;rsquo;s; in the earlier run it was the other way around, 35 against 32, so I would not read anything into it either.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;It is not the longer output.&lt;/strong&gt;&#10;MindRoom&amp;rsquo;s own shell tool returns the last 100 lines of a command&amp;rsquo;s output by default.&#10;For the native tools, I returned everything up to 50 KiB, because that is closer to what Claude Code and Codex do.&#10;So I ran everything again with the native tools capped at the same 100 lines, the second row in the chart above.&#10;The cap barely changes anything: Astra still uses 26% more tokens, Sol 15% more, and the Claude models still save about 8%.&#10;The models hardly ever print more than 100 lines anyway: in the uncapped run, 3 of Astra&amp;rsquo;s 91 shell results and 3 of Sol&amp;rsquo;s 93 were longer than that, and none of Claude&amp;rsquo;s 220.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Where the tokens went with the mixed set.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Tokens per task with MindRoom&amp;rsquo;s shell and file tools and with the native ones, split into the fixed part (light) and the work the model did on top of it (dark). Hover for the number of requests." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="tokenSplit"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Tokens per task with MindRoom&amp;rsquo;s shell and file tools and with the native ones, split into the fixed part (light) and the work the model did on top of it (dark). Hover for the number of requests.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;Claude did not work any differently with Claude Code&amp;rsquo;s tools.&#10;It never called a file tool with either set, did everything in the shell, and made about the same number of requests.&#10;Its work changed by 5% or less, and almost all of its savings come from the fixed part: the Claude Code-style definitions I wrote are about 480 tokens shorter than MindRoom&amp;rsquo;s.&lt;/p&gt;&#10;&lt;p&gt;GPT did work differently.&#10;With Codex&amp;rsquo;s tools, Astra and Sol edited files with &lt;code&gt;apply_patch&lt;/code&gt; 17 and 15 times, where with MindRoom&amp;rsquo;s tools they made only 3 and 5 calls to the file tools and did the rest from the shell.&#10;Each patch is a request of its own, which accounts for their 0.3 to 0.5 extra requests per task.&#10;They also did 51% and 24% more work.&#10;And Codex&amp;rsquo;s tools take about 130 more tokens to describe than MindRoom&amp;rsquo;s, because &lt;code&gt;apply_patch&lt;/code&gt; costs about 270 more than &lt;code&gt;edit_file&lt;/code&gt; and &lt;code&gt;write_file&lt;/code&gt; together, so the fixed part grew as well.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The mistakes.&lt;/strong&gt;&#10;None of the five models made a single tool error with MindRoom&amp;rsquo;s tools in its 36 runs.&#10;Partly, the models rarely needed the file tools: the Claude models never called one, and of the GPT models, only Luna used them often.&#10;The only model that made tool errors was Luna, and only with the Codex tools: 7 errors in 36 runs, all of them &lt;code&gt;read_file&lt;/code&gt; calls with a path relative to the directory Luna had just given &lt;code&gt;exec_command&lt;/code&gt;.&#10;The made-up fields in pi always appeared inside its nested list of replacements, where the model has to write the JSON for each replacement itself.&#10;MindRoom&amp;rsquo;s &lt;code&gt;edit_file&lt;/code&gt; is flat, like Claude Code&amp;rsquo;s &lt;code&gt;Edit&lt;/code&gt;: a path, the old text, and the new text.&#10;So I suspected that keeping the tools as simple as the native ones matters more than matching their exact names.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h2 id="older-models-only-opus-48-did-better-with-them"&gt;Older models: only Opus 4.8 did better with them &lt;a class="anchor" href="#older-models-only-opus-48-did-better-with-them" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The pi story made me wonder whether this used to be different, since Opus 4.8 struggled with pi&amp;rsquo;s edit tool while Opus 4.7 did not.&#10;So I ran the same comparisons on older models that are still available: Claude Opus 4.7, Opus 4.8, and Sonnet 5, and GPT-5.5 and GPT-5.6 Sol.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when the older models use their native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with only the harness&amp;rsquo;s own tools against MindRoom&amp;rsquo;s matching set, and with the mixed set in the pull request. Opus 4.7 and 4.8 ran without thinking, Sonnet 5 with adaptive thinking, and GPT with the effort Codex picks. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="fairOlder"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when the older models use their native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with only the harness&amp;rsquo;s own tools against MindRoom&amp;rsquo;s matching set, and with the mixed set in the pull request. Opus 4.7 and 4.8 ran without thinking, Sonnet 5 with adaptive thinking, and GPT with the effort Codex picks. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;With only each harness&amp;rsquo;s own tools, the older models did not prefer their native tools either, except for one.&#10;The exception is the model from the pi story: Opus 4.8 did 17% less work and used 19% fewer tokens with Claude Code&amp;rsquo;s tools, reading files through Bash instead of with a separate tool.&#10;With the mixed set, the older Claude models seemed to prefer Claude Code&amp;rsquo;s tools, using 22 to 36% fewer tokens, but that came from the extra tools the mixed set keeps from MindRoom, &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;find_files&lt;/code&gt;, and &lt;code&gt;ls&lt;/code&gt;: next to MindRoom&amp;rsquo;s other tools, those made the older Claude models take more steps and read more, and next to Claude Code&amp;rsquo;s tools, the models hardly touched them.&#10;And on the pi story itself: Opus 4.8 and Sonnet 5, the two models that made up fields in pi, made 111 edits with MindRoom&amp;rsquo;s &lt;code&gt;edit_file&lt;/code&gt;, which takes a single path, old text, and new text, and none of them failed.&lt;/p&gt;&#10;&lt;p&gt;With only each harness&amp;rsquo;s own tools, the GPT-5 models did about the same with either set, and unlike GPT-6 Astra and Sol, they barely used &lt;code&gt;apply_patch&lt;/code&gt;.&#10;So reaching for its native editing tool, and paying for it, is new in that generation.&lt;/p&gt;&#10;&lt;p&gt;Of the ten models I tested, familiar tools clearly made only one more efficient, the one that started it.&#10;The others did as well or better with tools they were presumably not trained on: they seem to generalize beyond the environment they were trained in.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;The numbers behind this section&lt;/summary&gt;&#10; &lt;p&gt;&lt;strong&gt;Only the harness&amp;rsquo;s own tools.&lt;/strong&gt;&#10;With Claude Code&amp;rsquo;s tools, Opus 4.7 used 3% fewer tokens [−12 to +6%], Opus 4.8 19% fewer [−26 to −11%], and Sonnet 5 7% fewer [−29 to +23%], a noisy result.&#10;Opus 4.8 did 17% less work [−29 to −4%] on top of the shorter definitions, while the other older models&amp;rsquo; work changed by −5 to +13%, none of it clearly; Opus 4.8 called MindRoom&amp;rsquo;s &lt;code&gt;read_file&lt;/code&gt; 27 times, but never Claude Code&amp;rsquo;s &lt;code&gt;Read&lt;/code&gt;.&#10;With Codex&amp;rsquo;s tools, GPT-5.5 used 5% more [−5 to +16%] and GPT-5.6 Sol 3% more [−4 to +11%]; they called &lt;code&gt;apply_patch&lt;/code&gt; only 3 and 9 times, where with MindRoom&amp;rsquo;s tools they made 20 and 16 calls to the file tools.&#10;The pass rates stayed within one or two runs of each other.&#10;None of the older models made a tool error with MindRoom&amp;rsquo;s matching set; with Codex&amp;rsquo;s, GPT-5.5 sent garbled working directories to &lt;code&gt;exec_command&lt;/code&gt; 11 times.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Why the mixed set made them look different.&lt;/strong&gt;&#10;The only difference between the two tests is that the mixed set adds MindRoom&amp;rsquo;s &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;find_files&lt;/code&gt;, and &lt;code&gt;ls&lt;/code&gt; to both sides.&#10;Next to MindRoom&amp;rsquo;s other tools, the older Claude models called &lt;code&gt;ls&lt;/code&gt; and &lt;code&gt;grep&lt;/code&gt; 20, 9, and 3 times, took 0.3 to 0.9 more requests per task, and did 35 to 38% more work than without them.&#10;Next to Claude Code&amp;rsquo;s tools, they called them once in total.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The older models with the mixed set.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals, oldest models first in each family. Each model&amp;rsquo;s reasoning mode is in parentheses: Opus 4.7 and 4.8 do not think, the other Claude models think adaptively, and GPT uses the effort Codex picks. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="generations"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when each model uses its native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals, oldest models first in each family. Each model&amp;rsquo;s reasoning mode is in parentheses: Opus 4.7 and 4.8 do not think, the other Claude models think adaptively, and GPT uses the effort Codex picks. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;Opus 4.7, Opus 4.8, and Sonnet 5 used 22 to 36% fewer tokens with Claude Code&amp;rsquo;s tools.&#10;Unlike the 5.5 models, they also made fewer requests and did 26 to 45% less work on top of the fixed part.&#10;GPT-5.6 Sol used 15% fewer tokens with Codex&amp;rsquo;s tools and did 27% less work, and GPT-5.5 used about the same.&#10;One generation later, the GPT-6 models use up to 31% more with Codex&amp;rsquo;s tools, and the Claude 5.5 models mostly save what the shorter definitions save.&#10;The pass rates stayed within one or two runs of each other for every model.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;How they used the file tools.&lt;/strong&gt;&#10;With MindRoom&amp;rsquo;s tools, the older Claude models called &lt;code&gt;read_file&lt;/code&gt; 24, 29, and 44 times; with Claude Code&amp;rsquo;s, they called &lt;code&gt;Read&lt;/code&gt; only 3, 1, and 6 times and read files through Bash instead.&#10;GPT-5.6 Sol needed 9 patches where it had made 32 calls to &lt;code&gt;edit_file&lt;/code&gt; and &lt;code&gt;write_file&lt;/code&gt;.&#10;Opus 4.8 and Sonnet 5 made 37 and 21 calls to MindRoom&amp;rsquo;s flat &lt;code&gt;edit_file&lt;/code&gt;, and none of them failed.&#10;That does not prove that pi&amp;rsquo;s nested list caused pi&amp;rsquo;s failures, because I never gave them a nested edit tool, but a flat one did not trigger them.&#10;Their few tool errors were different ones: Sonnet 5 twice polled a background command that did not exist, GPT-5.5 and GPT-5.6 Sol each had one edit whose old text did not match, and GPT-5.5 sent garbled working directories to Codex&amp;rsquo;s &lt;code&gt;exec_command&lt;/code&gt; seven times.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Only the shell tools.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when the older models use their native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with shell and file tools, and with only the shell tools. Opus 4.7 and 4.8 ran without thinking, Sonnet 5 with adaptive thinking, and GPT with the effort Codex picks. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="olderShell"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when the older models use their native harness tools instead of MindRoom&amp;rsquo;s, with 95% confidence intervals: with shell and file tools, and with only the shell tools. Opus 4.7 and 4.8 ran without thinking, Sonnet 5 with adaptive thinking, and GPT with the effort Codex picks. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;The native set mixes a model&amp;rsquo;s own tools with some of MindRoom&amp;rsquo;s, such as &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;ls&lt;/code&gt;, and, for GPT, &lt;code&gt;read_file&lt;/code&gt;, so I also ran the older models with only the shell tools, in MindRoom&amp;rsquo;s shape and in the native one.&#10;Opus 4.7 then used 10% fewer tokens with the native shell, GPT-5.6 Sol 6% fewer, and GPT-5.5 the same, and almost all of that came from shorter definitions.&#10;Opus 4.8 used 23% fewer tokens, made fewer requests, and did 16% less work.&#10;Sonnet 5&amp;rsquo;s result is too noisy to read: in one run, the native shell returned a 50 KB output early on, and resending it with every later request made that run cost 12 times the median; its median run used 9% fewer tokens with the native shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The reasoning settings.&lt;/strong&gt;&#10;Opus 4.7 and 4.8 do not think unless you ask them to, and Sonnet 5 thought before 42% of its replies, against 15 to 25% for the 5.5 models at the same adaptive setting.&#10;The GPT-5 models reasoned before 59 to 76% of their requests, while the GPT-6 models reasoned before only 4 to 12%.&#10;With adaptive thinking and the mixed set, Opus 4.7 and 4.8 thought before 26 to 36% of their replies, and still used 35% and 20% fewer tokens with Claude Code&amp;rsquo;s tools.&#10;For that test, I set &lt;code&gt;thinking&lt;/code&gt; to &lt;code&gt;adaptive&lt;/code&gt; in the model&amp;rsquo;s &lt;code&gt;extra_kwargs&lt;/code&gt;, since these models reject a fixed thinking budget.&lt;/p&gt;&#10;&lt;p&gt;I also ran one current model of each family, Claude Sonnet 5.5 and GPT-6 Astra, at low and at high reasoning effort.&#10;For Astra, I set &lt;code&gt;reasoning_effort&lt;/code&gt; to &lt;code&gt;low&lt;/code&gt; or &lt;code&gt;high&lt;/code&gt;; for Sonnet 5.5, &lt;code&gt;output_config.effort&lt;/code&gt;, which is how the Claude 5.5 models take a reasoning effort.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task when Claude Sonnet 5.5 and GPT-6 Astra use their native harness tools instead of MindRoom&amp;rsquo;s, at each reasoning effort, with 95% confidence intervals. With no effort set, Sonnet uses adaptive thinking, and Astra the effort Codex picks. Hover for the tokens per task." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="effortChange"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task when Claude Sonnet 5.5 and GPT-6 Astra use their native harness tools instead of MindRoom&amp;rsquo;s, at each reasoning effort, with 95% confidence intervals. With no effort set, Sonnet uses adaptive thinking, and Astra the effort Codex picks. Hover for the tokens per task.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;Both models passed all 36 runs at every effort with either set of tools, except for one run that Astra failed with MindRoom&amp;rsquo;s tools at its default effort.&#10;A higher effort made Codex&amp;rsquo;s tools worse for GPT. At high effort, Astra made 4.5 requests per task with Codex&amp;rsquo;s tools against 3.6 with MindRoom&amp;rsquo;s, and used 45% more tokens.&#10;Even at high effort, though, Astra reasoned before only 10 to 12% of its requests, against 4 to 7% at its default, far below the GPT-5 models.&#10;For Claude, the native tools stayed cheaper at every level, and saved the most at low effort, 19%, where Sonnet thought before only 3 to 4% of its replies.&#10;Sonnet thought about as often at its default as at high effort, so I would not read much into the difference between those two.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h2 id="what-does-matter-what-the-agent-sends"&gt;What does matter: what the agent sends &lt;a class="anchor" href="#what-does-matter-what-the-agent-sends" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My next guess was the other half of my plan, a smaller agent.&#10;Every request to the model resends the system prompt and the definition of every tool, so an agent with a shorter prompt and fewer tools sends less with every step.&lt;/p&gt;&#10;&lt;h3 id="fewer-tools"&gt;Fewer tools &lt;a class="anchor" href="#fewer-tools" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Fewer tools did help.&#10;With only MindRoom&amp;rsquo;s shell tools and none of its file tools, the agent used about a third fewer tokens and passed about as many runs.&#10;A shell-only agent is also where I still expected the native tools to matter most, because every step goes through the one tool whose shape the model knows best.&#10;They did not: GPT used the same number of tokens with Codex&amp;rsquo;s shell tools, and Claude saved only what its shorter descriptions save.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;The numbers behind this section&lt;/summary&gt;&#10; &lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task, with 95% confidence intervals: with only MindRoom&amp;rsquo;s shell tools instead of all of MindRoom&amp;rsquo;s tools, and with only the native shell tools instead of MindRoom&amp;rsquo;s. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="shellOnly"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task, with 95% confidence intervals: with only MindRoom&amp;rsquo;s shell tools instead of all of MindRoom&amp;rsquo;s tools, and with only the native shell tools instead of MindRoom&amp;rsquo;s. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;p&gt;With only MindRoom&amp;rsquo;s three shell tools, for running, checking, and stopping a command, and none of its file tools, the agent used 27 to 41% fewer tokens.&#10;It passed about as many runs: Luna passed 31 instead of 33, too small a difference to tell apart, and the other four models passed all 36.&lt;/p&gt;&#10;&lt;p&gt;For the native shape, I gave Claude only Claude Code&amp;rsquo;s &lt;code&gt;Bash&lt;/code&gt;, &lt;code&gt;BashOutput&lt;/code&gt;, and &lt;code&gt;KillShell&lt;/code&gt;, and GPT only Codex&amp;rsquo;s &lt;code&gt;exec_command&lt;/code&gt; and &lt;code&gt;write_stdin&lt;/code&gt;, with MindRoom&amp;rsquo;s &lt;code&gt;kill_shell_command&lt;/code&gt; in Codex&amp;rsquo;s style.&#10;For GPT, the total did not move: Astra, Sol, and Luna used the same number of tokens, within 2%, and made the same number of requests.&#10;Codex&amp;rsquo;s shell tools alone take about 130 fewer tokens to describe than MindRoom&amp;rsquo;s, and GPT spent about as much on extra work.&#10;Claude Sonnet 5.5 used 18% fewer tokens and Claude Opus 5.5 6% fewer, mostly because the Claude Code-style shell tools are shorter to describe than MindRoom&amp;rsquo;s.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h3 id="minimal-mode-one-shell-tool-and-a-12-line-prompt"&gt;Minimal mode: one shell tool and a 12-line prompt &lt;a class="anchor" href="#minimal-mode-one-shell-tool-and-a-12-line-prompt" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;MindRoom&amp;rsquo;s &lt;a href="https://docs.mindroom.chat/tools/agent-cli/" target="_blank" rel="noopener"&gt;minimal mode&lt;/a&gt;, modeled on DeepSeek&amp;rsquo;s minimal profile, takes this all the way.&#10;The agent gets a 12-line prompt and a single &lt;code&gt;bash&lt;/code&gt; tool instead of its normal prompt and tools.&#10;Its instructions, skills, context files, and memory move behind a command-line program inside that shell, which it can call when it needs them.&#10;Minimal mode only works in chat, so I ran this comparison in Matrix conversations, against the same agent in standard mode with only its shell tools.&#10;A chat adds context about the room to every request, but even so, the minimal agent used 21 to 52% fewer tokens than the shell-only agent through MindRoom&amp;rsquo;s API.&lt;/p&gt;&#10;&lt;p&gt;The difference starts before the model does anything.&#10;For Claude Sonnet 5.5, the prompt and tool definitions sent with every request shrink from 4,285 tokens to 661.&lt;sup id="fnref:5"&gt;&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref"&gt;5&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="What every request carries besides the conversation: the system prompt and the tool definitions, in standard and in minimal mode, from each provider&amp;rsquo;s own token counts. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="promptParts"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;What every request carries besides the conversation: the system prompt and the tool definitions, in standard and in minimal mode, from each provider&amp;rsquo;s own token counts. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Tokens per task in Matrix conversations: the same agent with only MindRoom&amp;rsquo;s shell tools, in standard mode and in minimal mode with its single bash tool, split into the fixed part (light) and the work the model did on top of it (dark). Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="minimalSplit"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Tokens per task in Matrix conversations: the same agent with only MindRoom&amp;rsquo;s shell tools, in standard mode and in minimal mode with its single bash tool, split into the fixed part (light) and the work the model did on top of it (dark). Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;Each bar splits a task&amp;rsquo;s tokens into the fixed part, the prompt and tool definitions resent with every request, and the work the model did on top of it.&#10;The minimal agent used 58 to 76% fewer tokens than the same agent in standard mode with only its shell tools, for every model.&#10;Most of that is input the provider had cached and bills at a fraction of the price, so the bill shrinks less than the token count does: counting only uncached input and output, the minimal agent used 16 to 42% fewer tokens.&#10;And the model did not pay for it with extra work: the dark part of the bars stayed about the same or shrank, except for Luna&amp;rsquo;s.&#10;I had also hoped that the smaller agent would need less to do the task itself, but only GPT-6 Astra and Sol did, with slightly fewer steps and about a quarter less output; Claude worked exactly the same in both modes.&lt;/p&gt;&#10;&lt;p&gt;These tasks are short, three or four requests each, which is why the prompt weighs so much.&#10;I tried to make them harder so they would take more steps, but the models were so good that they only took about 50% more requests, and for the two models I tried, Claude Sonnet 5.5 and GPT-6 Astra, the pattern stayed the same: Sonnet did the same work in both modes, and Astra less in minimal mode.&#10;For the models that save steps, I see no reason why longer tasks would erase that gain: every step saved also saves resending the conversation, so on long tasks it counts for more.&#10;In a long session, the growing conversation dominates and the prompt&amp;rsquo;s share of the tokens shrinks, but its saving per request stays: about 3,600 tokens for Claude and 2,200 for GPT.&#10;And a real agent&amp;rsquo;s prompt carries far more instructions, skills, and memory than this test agent&amp;rsquo;s, so it saves more per request, although fetching them through the shell when needed costs requests of its own.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;The numbers behind this section&lt;/summary&gt;&#10; &lt;p&gt;&lt;strong&gt;Why Matrix.&lt;/strong&gt;&#10;Minimal mode only works in chat conversations, so I ran it through Matrix, next to the same agent with only its shell tools in standard mode.&#10;Each run got a fresh chat room with only the agent, named &lt;code&gt;coder&lt;/code&gt;, and MindRoom&amp;rsquo;s router, which handles commands like &lt;code&gt;!mode&lt;/code&gt;; for minimal mode, I switched the room over with &lt;code&gt;!mode coder minimal&lt;/code&gt; before sending the task.&#10;In a Matrix conversation, the agent also gets context about the room and the conversation, so it uses more tokens than through the API: on the same code, with only the shell tools, Claude Opus 5.5 used 22,192 tokens per task in Matrix against 12,904 through the API.&#10;That is why I compare minimal mode with standard mode in Matrix.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The prompt.&lt;/strong&gt;&#10;In standard mode, the system prompt is 2,295 tokens for Claude Sonnet 5.5 and 1,463 for GPT-6 Astra, and the tool definitions, the shell tools and one for inviting MindRoom&amp;rsquo;s router, add another 1,990 and 867.&#10;In minimal mode, the system prompt is 152 and 97 tokens, and the single &lt;code&gt;bash&lt;/code&gt; tool adds 509 and 72.&#10;This test agent&amp;rsquo;s standard prompt is about 100 lines only because its own configuration is one role line and one instruction; a real agent&amp;rsquo;s prompt also carries its instructions, skills, context files, and memory, and can run to hundreds of lines, while its minimal prompt stays at 12.&#10;The model receives all of that, plus the task and the room&amp;rsquo;s context, again with every request, so it adds up: in standard mode, about 80% of all tokens were this fixed part.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The result.&lt;/strong&gt;&#10;Its first request dropped from about 4,600 to 1,000 input tokens for Claude, and from about 2,600 to 410 for GPT.&#10;Counting only the uncached input and the output, the minimal agent used 16 to 42% fewer tokens.&#10;Even with the extra context of a Matrix conversation, it used fewer tokens than the agent with only MindRoom&amp;rsquo;s shell tools through the API on the same code: 21 to 52% fewer.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Is that a fair comparison?&lt;/strong&gt;&#10;A shorter prompt saves tokens even if the model then has to work harder, so the real question is whether it had to.&#10;Mostly, it did not: the work stayed the same for both Claude models (1% and 3% less), and went down for Astra and Sol (38% and 13% less), which also needed fewer requests, about 3.0 per task instead of 3.3 to 3.4.&#10;Luna is the exception: it made more requests and did 40% more work in minimal mode, but the shorter prompt still more than paid for that.&#10;Counted per task without the resent conversation, the Claude models wrote and added to the conversation the same in both modes, Astra and Sol wrote about a quarter less and needed 0.2 to 0.4 fewer requests, and Luna added 33% more, mostly longer command output.&#10;Three of the five models failed one more run in minimal mode, mostly on the same script-writing task that other configurations also miss now and then.&#10;That is too small to tell apart here, but I will keep an eye on it with harder tasks.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h3 id="minimal-mode-with-each-models-native-shell-tool"&gt;Minimal mode with each model&amp;rsquo;s native shell tool &lt;a class="anchor" href="#minimal-mode-with-each-models-native-shell-tool" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;That leaves the combination I had in mind from the start: the minimal agent, with each model&amp;rsquo;s native shell tool as its only tool.&#10;I patched minimal mode so that its single tool appears as Claude Code&amp;rsquo;s &lt;code&gt;Bash&lt;/code&gt; for Claude and as Codex&amp;rsquo;s &lt;code&gt;exec_command&lt;/code&gt; for GPT, with the same 12-line prompt.&lt;sup id="fnref:6"&gt;&lt;a href="#fn:6" class="footnote-ref" role="doc-noteref"&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Change in tokens per task in minimal mode when its single tool is the model&amp;rsquo;s native shell tool, Claude Code&amp;rsquo;s Bash or Codex&amp;rsquo;s exec_command, instead of MindRoom&amp;rsquo;s bash, with 95% confidence intervals. The second row cuts the native tool&amp;rsquo;s output to the last 100 lines, MindRoom&amp;rsquo;s bash default. Hover for values." data-plot-module="/post/native-harness-tools/plots.js" data-plot-name="minimalNative"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Change in tokens per task in minimal mode when its single tool is the model&amp;rsquo;s native shell tool, Claude Code&amp;rsquo;s Bash or Codex&amp;rsquo;s exec_command, instead of MindRoom&amp;rsquo;s bash, with 95% confidence intervals. The second row cuts the native tool&amp;rsquo;s output to the last 100 lines, MindRoom&amp;rsquo;s bash default. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;It did not make the minimal agent better for any model.&#10;For Claude, it made little difference: Sonnet used about the same, and Opus a little more.&#10;For GPT, it was clearly worse, mostly because &lt;code&gt;exec_command&lt;/code&gt; hands back a command&amp;rsquo;s whole output, and in an agent that sends so little else, a few long outputs weigh a lot.&#10;With its output cut to 100 lines, &lt;code&gt;bash&lt;/code&gt;&amp;rsquo;s default and the light rows in the chart, only Sol still clearly used more; Astra&amp;rsquo;s and Luna&amp;rsquo;s smaller increases could be chance.&lt;/p&gt;&#10;&lt;p&gt;So the whole effect of the combination came from its minimal half: models that were trained with a carefully designed set of tools did best with one tool and almost no prompt, and the tool&amp;rsquo;s native shape did not make it better.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;The numbers behind this section&lt;/summary&gt;&#10; &lt;p&gt;The single native tool only runs commands, but no current model ever polled or stopped a command in any of these runs, so it lacked nothing they used.&#10;I ran it next to minimal mode with MindRoom&amp;rsquo;s own &lt;code&gt;bash&lt;/code&gt; on the same code, and once more with the native tool&amp;rsquo;s output cut to the last 100 lines.&#10;That is &lt;code&gt;bash&lt;/code&gt;&amp;rsquo;s default, which the GPT models set themselves on every call, more often lower than higher; in the end, the capped native tool and &lt;code&gt;bash&lt;/code&gt; returned about as much, except for Astra, whose &lt;code&gt;bash&lt;/code&gt; results were twice as long.&lt;/p&gt;&#10;&lt;p&gt;For Claude, Sonnet used 4% fewer tokens with the native tool and Opus 7% more.&#10;For GPT, it was 34 to 46% more tokens, mostly because &lt;code&gt;exec_command&lt;/code&gt; returns a command&amp;rsquo;s whole output, so the models read 39 to 50 lines per result instead of 20 to 36.&#10;Cut to 100 lines, the native tool cost GPT 5 to 15% more, but only Sol&amp;rsquo;s increase is clearly more than chance; part of it is the definition, which takes about 90 more tokens than &lt;code&gt;bash&lt;/code&gt; on every request.&#10;In minimal mode, the agent sends so little else that a few long outputs weigh much more than through the API: the cap cut Astra&amp;rsquo;s tokens by about 20% here, against 4% there.&#10;Claude rarely printed more than 100 lines, so I would not read anything into the gap between its two native rows.&#10;The pass rates differed by at most a few runs, too few to tell apart.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;h2 id="what-this-does-and-does-not-show"&gt;What this does and does not show &lt;a class="anchor" href="#what-this-does-and-does-not-show" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I tested the names and arguments of the tools, not whole harnesses. Claude Code and Codex also have their own tool descriptions, system prompts, and output formats, Codex has an interactive terminal, and RL trains all of that together. The full harness might still help today&amp;rsquo;s models; matching only the tools did not.&lt;/li&gt;&#10;&lt;li&gt;The tasks are easy and short: 97% of all runs passed, with three to seven requests per task on average. Harder, longer tasks might separate the tool sets on success, not only on cost.&lt;/li&gt;&#10;&lt;li&gt;With 36 runs per configuration, a 15 to 30% difference in tokens is clear, but a difference of one or two passed runs is not.&lt;/li&gt;&#10;&lt;li&gt;I tune MindRoom&amp;rsquo;s agent setup on other tasks from the same 12 families, and a note on working habits from that tuning sits in the shell tool&amp;rsquo;s description. Both tool sets carry the same note, so it should not favor either.&lt;/li&gt;&#10;&lt;li&gt;The confidence intervals cover run-to-run variation on these 12 tasks, not the choice of tasks. Resampling the tasks as well widens them: GPT-6 Astra&amp;rsquo;s +59%, for example, becomes +38 to +81%, and Sonnet 5.5&amp;rsquo;s 6% saving becomes indistinguishable from none. Astra and Sol still used more tokens with Codex&amp;rsquo;s tools on every one of the 12 tasks, and the minimal agent used fewer on every task, for every model.&lt;/li&gt;&#10;&lt;li&gt;Most runs used each model&amp;rsquo;s standard reasoning mode, which differs between generations: adaptive thinking for Sonnet 5 and the 5.5 models, none for Opus 4.7 and 4.8, and the effort Codex picks for GPT. I tried other settings on four models: two current ones at low and high effort, and Opus 4.7 and 4.8 with adaptive thinking. The pattern held at every effort: Astra used 27 to 45% more tokens with Codex&amp;rsquo;s tools, and Sonnet 5.5 stayed slightly cheaper with Claude Code&amp;rsquo;s.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="what-happens-to-the-pull-request"&gt;What happens to the pull request &lt;a class="anchor" href="#what-happens-to-the-pull-request" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The pull request is still unmerged, and given these results, I am not sure I will merge it at all.&#10;For today&amp;rsquo;s models, the native tools either cost more, as Codex&amp;rsquo;s did for GPT-6 Astra and Sol, or, as Claude Code&amp;rsquo;s did for Claude, only saved the few tokens of the shorter descriptions I wrote for them, which MindRoom&amp;rsquo;s own tools could get too.&#10;The one model that clearly did better with its own tools, Claude Opus 4.8, is a generation behind.&#10;What I will do is use minimal mode a lot more, with MindRoom&amp;rsquo;s own &lt;code&gt;bash&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="why-this-excites-me"&gt;Why this excites me &lt;a class="anchor" href="#why-this-excites-me" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Half of my plan was wrong, and I am happy about that.&#10;The minimal-harness, DeepSeek-style half held up; the native-tools half did not.&#10;The benchmarks I did not believe were right, at least for these models.&#10;It suggests that these models generalize much better than I gave them credit for.&#10;They were trained with one specific set of tools, and on these tasks they did just as well with tools they had presumably never seen in training, as long as those tools were simple, like an edit tool that takes one path, the old text, and the new text.&#10;Only Opus 4.8, the model that started all this, still did better with its native tools.&#10;What matters more than familiarity is how much the agent sends with every request: the prompt and the definition of every tool.&lt;/p&gt;&#10;&lt;p&gt;It also changes how I think about who gets to build the best agents.&#10;If models only worked well in the harness they were trained in, the labs would own the best agents by default.&#10;Instead, at least the skill of using unfamiliar tools seems to carry over to other harnesses.&#10;I suspect the same holds one level up, for how several agents work together.&#10;The labs presumably train their models in their own harness, but if what the models learn transfers this well, a harness built outside the labs, like MindRoom, could get just as good at letting agents collaborate.&#10;That is still a hunch, and testing it is what I want to do next.&lt;/p&gt;&#10;&lt;h2 id="appendix-how-i-measured-and-the-numbers-behind-the-charts"&gt;Appendix: how I measured, and the numbers behind the charts &lt;a class="anchor" href="#appendix-how-i-measured-and-the-numbers-behind-the-charts" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All scripts, the tasks, and one row per trial, with its reasoning setting, are &lt;a href="https://github.com/basnijholt/nijho.lt/tree/main/content/post/native-harness-tools/reproduce" target="_blank" rel="noopener"&gt;on GitHub next to this post&amp;rsquo;s source&lt;/a&gt;.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;Show the setup and every configuration&lt;/summary&gt;&#10; &lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Each configuration ran as a separate MindRoom instance with one agent and a fresh Docker container for its commands. The model, the tools, and everything else were fixed in that instance&amp;rsquo;s configuration.&lt;/li&gt;&#10;&lt;li&gt;The tool comparisons ran through MindRoom&amp;rsquo;s OpenAI-compatible API on the pull request at commit &lt;code&gt;d73aafb51&lt;/code&gt;: the matching sets, the mixed sets with whole and with 100-line output, and both shell-only setups. The capped run changed only the output limit of the native shell tools.&lt;/li&gt;&#10;&lt;li&gt;The minimal-mode runs and their standard-mode comparison ran through Matrix on MindRoom&amp;rsquo;s main branch at release &lt;code&gt;v2026.10.228&lt;/code&gt;, whose shell tools lack two arguments the pull request added, a working directory and a wait. A shell-only run through the API on that release used within 3% of the pull request&amp;rsquo;s tokens for every model except Luna, which used 8% fewer.&lt;/li&gt;&#10;&lt;li&gt;The combination ran through Matrix on the pull request with an experiment patch that shows minimal mode&amp;rsquo;s single tool in the model&amp;rsquo;s own dialect. On that code, minimal mode with MindRoom&amp;rsquo;s &lt;code&gt;bash&lt;/code&gt; used within 10% of its tokens on main for every model.&lt;/li&gt;&#10;&lt;li&gt;Tokens per task are the input and output tokens of every model request in that task, from MindRoom&amp;rsquo;s per-request usage logs. The work is what is left after subtracting the fixed part, the first request&amp;rsquo;s input times the number of requests.&lt;/li&gt;&#10;&lt;li&gt;The confidence intervals come from resampling the three runs of each task 5,000 times, keeping the mix of tasks fixed.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Each cell shows passed runs out of 36, then tokens per task; the work columns show how much the work changed with the native tools.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Matching sets: each harness&amp;rsquo;s own tools against MindRoom&amp;rsquo;s matching set (pull request, through MindRoom&amp;rsquo;s API)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Reasoning&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s set&lt;/th&gt;&#10;&lt;th&gt;Harness&amp;rsquo;s own set&lt;/th&gt;&#10;&lt;th&gt;Work with the harness&amp;rsquo;s set&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 5.5&lt;/td&gt;&#10;&lt;td&gt;adaptive thinking&lt;/td&gt;&#10;&lt;td&gt;36/36 · 15,661&lt;/td&gt;&#10;&lt;td&gt;35/36 · 13,628 (−13%)&lt;/td&gt;&#10;&lt;td&gt;+7%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;adaptive thinking&lt;/td&gt;&#10;&lt;td&gt;36/36 · 14,606&lt;/td&gt;&#10;&lt;td&gt;36/36 · 13,764 (−6%)&lt;/td&gt;&#10;&lt;td&gt;+15%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;36/36 · 7,041&lt;/td&gt;&#10;&lt;td&gt;36/36 · 11,206 (+59%)&lt;/td&gt;&#10;&lt;td&gt;+84%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;36/36 · 7,292&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,417 (+43%)&lt;/td&gt;&#10;&lt;td&gt;+60%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;35/36 · 8,425&lt;/td&gt;&#10;&lt;td&gt;34/36 · 8,638 (+3%)&lt;/td&gt;&#10;&lt;td&gt;−5%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.7&lt;/td&gt;&#10;&lt;td&gt;no thinking&lt;/td&gt;&#10;&lt;td&gt;34/36 · 24,398&lt;/td&gt;&#10;&lt;td&gt;33/36 · 23,564 (−3%)&lt;/td&gt;&#10;&lt;td&gt;+13%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.8&lt;/td&gt;&#10;&lt;td&gt;no thinking&lt;/td&gt;&#10;&lt;td&gt;33/36 · 24,103&lt;/td&gt;&#10;&lt;td&gt;34/36 · 19,593 (−19%)&lt;/td&gt;&#10;&lt;td&gt;−17%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5&lt;/td&gt;&#10;&lt;td&gt;adaptive thinking&lt;/td&gt;&#10;&lt;td&gt;33/36 · 29,781&lt;/td&gt;&#10;&lt;td&gt;35/36 · 27,833 (−7%)&lt;/td&gt;&#10;&lt;td&gt;+9%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.5&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;35/36 · 10,819&lt;/td&gt;&#10;&lt;td&gt;35/36 · 11,353 (+5%)&lt;/td&gt;&#10;&lt;td&gt;+2%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,624&lt;/td&gt;&#10;&lt;td&gt;34/36 · 10,991 (+3%)&lt;/td&gt;&#10;&lt;td&gt;−5%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;For Claude, both sets have a shell and tools to read, edit, and write files; for GPT, a shell and Codex&amp;rsquo;s &lt;code&gt;apply_patch&lt;/code&gt; against MindRoom&amp;rsquo;s tools to edit and write files. Neither has MindRoom&amp;rsquo;s &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;find_files&lt;/code&gt;, or &lt;code&gt;ls&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Mixed sets: native tools against MindRoom&amp;rsquo;s tools (pull request, through MindRoom&amp;rsquo;s API; Claude with adaptive thinking, GPT with the effort Codex picks)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s tools&lt;/th&gt;&#10;&lt;th&gt;Native tools&lt;/th&gt;&#10;&lt;th&gt;Native tools, 100-line output&lt;/th&gt;&#10;&lt;th&gt;Work with native tools&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 18,943&lt;/td&gt;&#10;&lt;td&gt;36/36 · 17,244 (−9%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 17,410 (−8%)&lt;/td&gt;&#10;&lt;td&gt;+5%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 17,765&lt;/td&gt;&#10;&lt;td&gt;36/36 · 16,237 (−9%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 16,399 (−8%)&lt;/td&gt;&#10;&lt;td&gt;−4%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;35/36 · 8,250&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,807 (+31%)&lt;/td&gt;&#10;&lt;td&gt;35/36 · 10,399 (+26%)&lt;/td&gt;&#10;&lt;td&gt;+51%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,873&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,534 (+19%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,239 (+15%)&lt;/td&gt;&#10;&lt;td&gt;+24%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;33/36 · 12,003&lt;/td&gt;&#10;&lt;td&gt;35/36 · 11,532 (−4%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,816 (−10%)&lt;/td&gt;&#10;&lt;td&gt;+15%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Older models, mixed sets: native tools against MindRoom&amp;rsquo;s tools (pull request, through MindRoom&amp;rsquo;s API)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Reasoning&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s tools&lt;/th&gt;&#10;&lt;th&gt;Native tools&lt;/th&gt;&#10;&lt;th&gt;Work with native tools&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.7&lt;/td&gt;&#10;&lt;td&gt;no thinking&lt;/td&gt;&#10;&lt;td&gt;34/36 · 33,140&lt;/td&gt;&#10;&lt;td&gt;33/36 · 25,793 (−22%)&lt;/td&gt;&#10;&lt;td&gt;−26%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.8&lt;/td&gt;&#10;&lt;td&gt;no thinking&lt;/td&gt;&#10;&lt;td&gt;33/36 · 32,219&lt;/td&gt;&#10;&lt;td&gt;34/36 · 23,843 (−26%)&lt;/td&gt;&#10;&lt;td&gt;−32%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5&lt;/td&gt;&#10;&lt;td&gt;adaptive thinking&lt;/td&gt;&#10;&lt;td&gt;33/36 · 42,349&lt;/td&gt;&#10;&lt;td&gt;34/36 · 27,120 (−36%)&lt;/td&gt;&#10;&lt;td&gt;−45%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.5&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;34/36 · 15,007&lt;/td&gt;&#10;&lt;td&gt;36/36 · 14,419 (−4%)&lt;/td&gt;&#10;&lt;td&gt;−11%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;&#10;&lt;td&gt;Codex&amp;rsquo;s choice&lt;/td&gt;&#10;&lt;td&gt;36/36 · 15,062&lt;/td&gt;&#10;&lt;td&gt;35/36 · 12,809 (−15%)&lt;/td&gt;&#10;&lt;td&gt;−27%&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Older models, only the shell tools: native shape against MindRoom&amp;rsquo;s (pull request, through MindRoom&amp;rsquo;s API; Opus 4.7 and 4.8 without thinking, Sonnet 5 with adaptive thinking, GPT with the effort Codex picks)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s shell&lt;/th&gt;&#10;&lt;th&gt;Native shell&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.7&lt;/td&gt;&#10;&lt;td&gt;33/36 · 17,518&lt;/td&gt;&#10;&lt;td&gt;33/36 · 15,714 (−10%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.8&lt;/td&gt;&#10;&lt;td&gt;35/36 · 19,183&lt;/td&gt;&#10;&lt;td&gt;33/36 · 14,686 (−23%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5&lt;/td&gt;&#10;&lt;td&gt;33/36 · 22,624&lt;/td&gt;&#10;&lt;td&gt;33/36 · 28,354 (+25%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 9,056&lt;/td&gt;&#10;&lt;td&gt;36/36 · 9,046 (0%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;&#10;&lt;td&gt;36/36 · 9,171&lt;/td&gt;&#10;&lt;td&gt;34/36 · 8,658 (−6%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Sonnet 5&amp;rsquo;s native mean comes from one run that cost 271,106 tokens, after a 50 KB command output; its median is 9% lower with the native shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Opus 4.7 and 4.8 with adaptive thinking, mixed sets: native tools against MindRoom&amp;rsquo;s tools (pull request, through MindRoom&amp;rsquo;s API)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Thinking replies&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s tools&lt;/th&gt;&#10;&lt;th&gt;Native tools&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.7&lt;/td&gt;&#10;&lt;td&gt;26% and 31%&lt;/td&gt;&#10;&lt;td&gt;35/36 · 35,610&lt;/td&gt;&#10;&lt;td&gt;33/36 · 23,090 (−35%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 4.8&lt;/td&gt;&#10;&lt;td&gt;36% and 30%&lt;/td&gt;&#10;&lt;td&gt;33/36 · 25,269&lt;/td&gt;&#10;&lt;td&gt;33/36 · 20,130 (−20%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Reasoning effort, mixed sets: native tools against MindRoom&amp;rsquo;s tools (pull request, through MindRoom&amp;rsquo;s API)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Reasoning effort&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s tools&lt;/th&gt;&#10;&lt;th&gt;Native tools&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;low&lt;/td&gt;&#10;&lt;td&gt;36/36 · 15,154&lt;/td&gt;&#10;&lt;td&gt;36/36 · 12,330 (−19%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;default&lt;/td&gt;&#10;&lt;td&gt;36/36 · 17,765&lt;/td&gt;&#10;&lt;td&gt;36/36 · 16,237 (−9%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;high&lt;/td&gt;&#10;&lt;td&gt;36/36 · 18,286&lt;/td&gt;&#10;&lt;td&gt;36/36 · 15,630 (−15%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;low&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,361&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,627 (+27%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;default&lt;/td&gt;&#10;&lt;td&gt;35/36 · 8,250&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,807 (+31%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;high&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,934&lt;/td&gt;&#10;&lt;td&gt;36/36 · 12,918 (+45%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Only the shell tools (pull request, through MindRoom&amp;rsquo;s API; Claude with adaptive thinking, GPT with the effort Codex picks)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;All of MindRoom&amp;rsquo;s tools&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s shell only&lt;/th&gt;&#10;&lt;th&gt;Native shell only&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 18,943&lt;/td&gt;&#10;&lt;td&gt;36/36 · 12,926 (−32%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 12,202 (−6%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 17,765&lt;/td&gt;&#10;&lt;td&gt;36/36 · 12,455 (−30%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 10,168 (−18%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;35/36 · 8,250&lt;/td&gt;&#10;&lt;td&gt;36/36 · 6,025 (−27%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 6,052 (0%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,873&lt;/td&gt;&#10;&lt;td&gt;36/36 · 6,195 (−30%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 6,177 (0%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;33/36 · 12,003&lt;/td&gt;&#10;&lt;td&gt;31/36 · 7,118 (−41%)&lt;/td&gt;&#10;&lt;td&gt;34/36 · 7,018 (−1%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;MindRoom&amp;rsquo;s shell alone is compared with all of MindRoom&amp;rsquo;s tools, and the native shell with MindRoom&amp;rsquo;s shell.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Minimal mode against standard mode (main branch, through Matrix, shell tools only; Claude with adaptive thinking, GPT with the effort Codex picks)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Standard mode&lt;/th&gt;&#10;&lt;th&gt;Minimal mode&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 22,192&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,030 (−64%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;35/36 · 22,448&lt;/td&gt;&#10;&lt;td&gt;34/36 · 7,828 (−65%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;36/36 · 11,429&lt;/td&gt;&#10;&lt;td&gt;36/36 · 2,798 (−76%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;&#10;&lt;td&gt;36/36 · 11,070&lt;/td&gt;&#10;&lt;td&gt;35/36 · 3,370 (−70%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;35/36 · 12,568&lt;/td&gt;&#10;&lt;td&gt;34/36 · 5,219 (−58%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;strong&gt;Minimal mode: the native tool against MindRoom&amp;rsquo;s &lt;code&gt;bash&lt;/code&gt; (pull request with the experiment patch, through Matrix; Claude with adaptive thinking, GPT with the effort Codex picks)&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;MindRoom&amp;rsquo;s &lt;code&gt;bash&lt;/code&gt;&lt;/th&gt;&#10;&lt;th&gt;Native tool&lt;/th&gt;&#10;&lt;th&gt;Native tool, 100-line output&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Opus 5.5&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,058&lt;/td&gt;&#10;&lt;td&gt;36/36 · 8,654 (+7%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 9,123 (+13%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Claude Sonnet 5.5&lt;/td&gt;&#10;&lt;td&gt;34/36 · 7,787&lt;/td&gt;&#10;&lt;td&gt;34/36 · 7,514 (−4%)&lt;/td&gt;&#10;&lt;td&gt;34/36 · 8,000 (+3%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Astra&lt;/td&gt;&#10;&lt;td&gt;35/36 · 3,071&lt;/td&gt;&#10;&lt;td&gt;36/36 · 4,173 (+36%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 3,359 (+9%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6.1 Sol&lt;/td&gt;&#10;&lt;td&gt;34/36 · 3,103&lt;/td&gt;&#10;&lt;td&gt;33/36 · 4,150 (+34%)&lt;/td&gt;&#10;&lt;td&gt;36/36 · 3,575 (+15%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;34/36 · 4,697&lt;/td&gt;&#10;&lt;td&gt;34/36 · 6,849 (+46%)&lt;/td&gt;&#10;&lt;td&gt;32/36 · 4,926 (+5%)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;One of Luna&amp;rsquo;s runs with the whole native output counts for passes but not for tokens: the provider reported no usage for one of its requests.&lt;/p&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;div class="footnotes" role="doc-endnotes"&gt;&#10;&lt;hr&gt;&#10;&lt;ol&gt;&#10;&lt;li id="fn:1"&gt;&#10;&lt;p&gt;Armin also found that Anthropic&amp;rsquo;s strict tool mode, which restricts the model&amp;rsquo;s output to the tool&amp;rsquo;s schema, made these failures disappear in his tests. Pi later turned it on for Claude models, and a pi user then &lt;a href="https://github.com/earendil-works/pi/issues/10074#issuecomment-6000381416" target="_blank" rel="noopener"&gt;linked a different problem to it&lt;/a&gt;: in that user&amp;rsquo;s logs, 9.5% of Claude&amp;rsquo;s edits had mangled &lt;code&gt;\u&lt;/code&gt; escapes for non-ASCII text, such as Korean, with strict mode on, and 1.5% with it off.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:2"&gt;&#10;&lt;p&gt;The 12 tasks come from 12 families: a CSV report, finding the commit that broke a check, renaming an API across a package, counting errors in log files, fixing failing tests, finding files, extracting fields from JSON, writing a shell script, editing a configuration file, counting matching lines in very long command output, unpacking nested archives, and deduplicating and merging data files. I tune MindRoom&amp;rsquo;s agent setup on other instances of these families, and these 12 were held out from that.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:3"&gt;&#10;&lt;p&gt;Claude and GPT count tokens differently, so compare the numbers within one model, not across models. Cached input counts in full here, although providers bill it at a fraction of the price, so a bill changes less than the token count.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:4"&gt;&#10;&lt;p&gt;MindRoom&amp;rsquo;s toolkits accept &lt;code&gt;exclude_tools&lt;/code&gt;, so both sets drop MindRoom&amp;rsquo;s &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;find_files&lt;/code&gt;, and &lt;code&gt;ls&lt;/code&gt;, and for GPT also &lt;code&gt;read_file&lt;/code&gt;, since Codex reads files through the shell. Both keep their shell&amp;rsquo;s tools for checking on and stopping a background command, which no model used in the matching-set runs.&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:5"&gt;&#10;&lt;p&gt;Anthropic adds its own instructions for tool use to every request that has tools, which is why MindRoom&amp;rsquo;s single &lt;code&gt;bash&lt;/code&gt; tool costs Claude 509 tokens. I measured all of these numbers by sending each part on its own and reading the input tokens the provider reported.&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:6"&gt;&#10;&lt;p&gt;The patch is with this post&amp;rsquo;s reproduction scripts. It shows minimal mode&amp;rsquo;s single tool as MindRoom&amp;rsquo;s canonical run function, which the tool dialect then presents as &lt;code&gt;Bash&lt;/code&gt; or &lt;code&gt;exec_command&lt;/code&gt;; nothing else about minimal mode changes.&amp;#160;&lt;a href="#fnref:6" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/div&gt;&#10;</description></item><item><title>Self-hosting AI does not save money, and I do it anyway</title><link>https://www.nijho.lt/post/self-hosting-ai-is-not-cheaper/</link><pubDate>Fri, 02 Oct 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/self-hosting-ai-is-not-cheaper/</guid><description>&lt;p&gt;I have had this debate many times, so I am finally writing it down.&lt;/p&gt;&#10;&lt;p&gt;Whenever I say that self-hosting AI does not save money, people hear that I am against self-hosting.&#10;That is not the point at all.&#10;I am a massive fan of open-weight models.&#10;&lt;a href="https://github.com/basnijholt/dotfiles/blob/e63a3f341ff36b7b57bf31361c2844e1d8b78e95/configs/nixos/hosts/pc/ai.nix#L43" target="_blank" rel="noopener"&gt;Qwen3.8 27B runs on two RTX 3090s at home&lt;/a&gt; (and 15 more models), and my phone dictation goes to &lt;a href="https://www.nijho.lt/post/diction-agent-cli-qwen/"&gt;Qwen3-ASR on the same machine&lt;/a&gt;.&#10;I think open-source AI is the best thing since sliced bread.&lt;/p&gt;&#10;&lt;p&gt;I don&amp;rsquo;t pretend it saves money.&#10;I do it for fun, for sovereignty, and for privacy, which I come back to at the end.&lt;/p&gt;&#10;&lt;p&gt;All benchmark numbers and prices below come from &lt;a href="https://artificialanalysis.ai/" target="_blank" rel="noopener"&gt;Artificial Analysis&lt;/a&gt; and &lt;a href="https://openrouter.ai/" target="_blank" rel="noopener"&gt;OpenRouter&lt;/a&gt; as of September 30, 2026.&#10;I did the math for the hardware I own, and for the counterarguments I hear most.&#10;All assumptions are listed &lt;a href="#appendix-all-assumptions"&gt;at the end&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Benchmarks are not everything, and a high score does not reliably predict how a model does on real work.&#10;They are still the best we have: all models are benchmaxed, tuned to do well on the popular benchmarks, so the scores at least work as a reference frame for comparing them with each other.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Update, October 2, 2026: after the discussion on r/LocalLLaMA, I added &lt;a href="#5-but-my-mac-dgx-spark-or-ai-max-does-save-money"&gt;section 5&lt;/a&gt; on Macs, DGX Sparks, and AMD AI Max machines.&lt;/em&gt;&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-the-model-i-love-and-the-one-that-beats-it-on-price"&gt;1. The model I love, and the one that beats it on price&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-but-my-gpus-are-already-paid-for"&gt;2. &amp;ldquo;But my GPUs are already paid for&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-why-datacenters-are-so-much-better-at-this"&gt;3. Why datacenters are so much better at this&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-but-i-have-solar-panels"&gt;4. &amp;ldquo;But I have solar panels&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-but-my-mac-dgx-spark-or-ai-max-does-save-money"&gt;5. &amp;ldquo;But my Mac, DGX Spark, or AI Max does save money&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-the-bar-keeps-moving"&gt;6. The bar keeps moving&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-a-small-company-has-it-worse"&gt;7. A small company has it worse&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-they-lose-money-on-inference-so-prices-will-go-up"&gt;8. &amp;ldquo;They lose money on inference, so prices will go up&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-but-they-sell-your-data"&gt;9. &amp;ldquo;But they sell your data&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#10-where-self-hosting-does-win-the-same-model"&gt;10. Where self-hosting does win: the same model&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#11-so-why-do-i-do-it"&gt;11. So why do I do it?&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#appendix-all-assumptions"&gt;Appendix: all assumptions&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-the-model-i-love-and-the-one-that-beats-it-on-price"&gt;1. The model I love, and the one that beats it on price &lt;a class="anchor" href="#1-the-model-i-love-and-the-one-that-beats-it-on-price" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My favorite local model right now is &lt;a href="https://artificialanalysis.ai/models/qwen3-8-27b" target="_blank" rel="noopener"&gt;Qwen3.8 27B&lt;/a&gt;.&#10;It came out in August and it is Apache-2.0.&#10;People often say models like this run on a single gaming GPU, but that is only true after quantizing them.&#10;At full precision, Qwen3.8 27B needs about 54 GB of memory.&#10;Quantized to about 4 bits per weight, it fits on one 24 GB card, at some cost in quality.&#10;I still &lt;a href="https://github.com/basnijholt/dotfiles/blob/e63a3f341ff36b7b57bf31361c2844e1d8b78e95/configs/nixos/hosts/pc/ai.nix#L56-L65" target="_blank" rel="noopener"&gt;split it across both of my 3090s&lt;/a&gt;, because the second card leaves room for a larger context window.&lt;/p&gt;&#10;&lt;p&gt;I compare it with OpenAI&amp;rsquo;s &lt;a href="https://artificialanalysis.ai/models/gpt-6-luna" target="_blank" rel="noopener"&gt;GPT-6 Luna&lt;/a&gt;, the cheap tier released on September 22.&#10;Both models let you choose how long they think, but the settings do not mean the same thing for both.&#10;Luna&amp;rsquo;s token use grows more than 20 times from its lowest setting to its highest, while Qwen&amp;rsquo;s barely changes.&#10;Qwen on low already writes more tokens than Luna on xhigh.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Average output tokens per Intelligence Index task at each reasoning setting. Qwen3.8 27B has no high or max setting. Hover for scores." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="effortTokens"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Average output tokens per Intelligence Index task at each reasoning setting. Qwen3.8 27B has no high or max setting. Hover for scores.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;So the name of a setting says little on its own.&#10;I compare both models at xhigh, the highest setting Qwen offers, and count the tokens each one actually uses.&#10;The extra tokens Qwen needs are part of what I am measuring.&#10;There, Qwen scores 33.7 on the &lt;a href="https://artificialanalysis.ai/methodology/intelligence-benchmarking" target="_blank" rel="noopener"&gt;Artificial Analysis Intelligence Index&lt;/a&gt; and Luna scores 34.6.&#10;For reference, Claude Opus 4.6, a frontier model from February, scores 31.9.&#10;That is an amazing feat in itself.&#10;When Opus 4.6 was the best model we had, I never thought that within the same year I could run essentially that level of intelligence in my own house.&lt;/p&gt;&#10;&lt;p&gt;Artificial Analysis also &lt;a href="https://artificialanalysis.ai/leaderboards/models" target="_blank" rel="noopener"&gt;publishes&lt;/a&gt; how many tokens each model used to run the index, and what that cost.&#10;So the question is simple: what does it cost to run the whole benchmark once?&lt;sup id="fnref:1"&gt;&lt;a href="#fn:1" class="footnote-ref" role="doc-noteref"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Cost of one run of the Artificial Analysis Intelligence Index. The two bars for hardware at home are electricity only: measured on my 3090s, estimated for the RTX PRO 6000." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="runCost"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Cost of one run of the Artificial Analysis Intelligence Index. The two bars for hardware at home are electricity only: measured on my 3090s, estimated for the RTX PRO 6000.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;Luna runs the whole benchmark for $67.&#10;Qwen at full precision, through the &lt;a href="https://openrouter.ai/qwen/qwen3.8-27b/providers" target="_blank" rel="noopener"&gt;cheapest provider&lt;/a&gt; that does not keep your data (ZDR), costs $619.&#10;Two things cause that gap: providers charge almost four times as much per output token for Qwen, and Qwen generates almost three times as many tokens to get the same work done.&lt;/p&gt;&#10;&lt;p&gt;The second bar is my own machine: the electricity alone for running Qwen on my GPUs costs more than Luna&amp;rsquo;s entire bill.&lt;/p&gt;&#10;&lt;p&gt;The third bar is what it takes to match the API&amp;rsquo;s full precision at home: an RTX PRO 6000, a workstation card with 96 GB of memory, enough for the full model.&lt;sup id="fnref:2"&gt;&lt;a href="#fn:2" class="footnote-ref" role="doc-noteref"&gt;2&lt;/a&gt;&lt;/sup&gt;&#10;Its electricity alone costs twice Luna&amp;rsquo;s bill, and one run takes more than seven weeks.&#10;The card by itself sells for $10,000 to $20,000, so with a computer around it, you are paying for a pretty nice car.&#10;Buy a few of them to run agents in parallel, and you are building a small data center of your own.&lt;/p&gt;&#10;&lt;p&gt;The bars for hardware at home are electricity only, so they are the lowest these runs can cost: the cards come on top, and how much depends on how busy you keep them, which is what section 4 is about.&lt;/p&gt;&#10;&lt;p&gt;What I care about is the cheapest way to get answers of Qwen&amp;rsquo;s quality, from whichever model gives them.&lt;/p&gt;&#10;&lt;h2 id="2-but-my-gpus-are-already-paid-for"&gt;2. &amp;ldquo;But my GPUs are already paid for&amp;rdquo; &lt;a class="anchor" href="#2-but-my-gpus-are-already-paid-for" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This is the argument I hear most, so assume the hardware is free and only the electricity counts.&lt;/p&gt;&#10;&lt;p&gt;I measured my own machine.&#10;It runs Qwen in vLLM, split across both cards, at about 107 tokens per second.&lt;sup id="fnref:3"&gt;&lt;a href="#fn:3" class="footnote-ref" role="doc-noteref"&gt;3&lt;/a&gt;&lt;/sup&gt;&#10;The cards are capped at 270 W each,&lt;sup id="fnref:4"&gt;&lt;a href="#fn:4" class="footnote-ref" role="doc-noteref"&gt;4&lt;/a&gt;&lt;/sup&gt; and the whole machine draws about 700 W.&#10;It then needs four weeks, running day and night, to get through the benchmark once.&#10;I also give my quantized copy the score Artificial Analysis measured through Alibaba&amp;rsquo;s API.&#10;I have not rerun the benchmark on it, and anything lost to quantization makes my machine look worse.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Electricity for one benchmark run of Qwen3.8 27B on my two 3090s, by electricity price. The dashed line is what Luna charges for the same work, with OpenAI&amp;rsquo;s hardware and margin included. Hover for values." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="electricityCost"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Electricity for one benchmark run of Qwen3.8 27B on my two 3090s, by electricity price. The dashed line is what Luna charges for the same work, with OpenAI&amp;rsquo;s hardware and margin included. Hover for values.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;Above 14.5 cents per kWh, my electricity alone costs more than Luna&amp;rsquo;s API bill.&#10;Below it, I save a few dollars per run and wait four weeks instead of a few hours.&lt;/p&gt;&#10;&lt;p&gt;Those four weeks matter more than the few dollars.&#10;An API takes hundreds of requests at once, so even one benchmark run can finish in an hour or two.&#10;My setup works on one conversation at a time: when I sent it eight requests at once, seven of them waited in line.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Wall-clock time for one benchmark run. The API times use Artificial Analysis&amp;rsquo;s measured time per task for Luna; the parallel case assumes 100 requests at once. Log scale." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="wallClock"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Wall-clock time for one benchmark run. The API times use Artificial Analysis&amp;rsquo;s measured time per task for Luna; the parallel case assumes 100 requests at once. Log scale.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;This is one more reason my coding agents run on APIs.&#10;When I &lt;a href="https://www.nijho.lt/post/parallel-agentic-coding/"&gt;run several agents in parallel&lt;/a&gt;, each of them should be as fast as if it were alone.&lt;/p&gt;&#10;&lt;h2 id="3-why-datacenters-are-so-much-better-at-this"&gt;3. Why datacenters are so much better at this &lt;a class="anchor" href="#3-why-datacenters-are-so-much-better-at-this" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When my 3090s generate a token, they read all of the model&amp;rsquo;s weights from memory to produce one token for one conversation.&#10;Most of the chip&amp;rsquo;s compute sits idle while it waits for memory.&#10;A datacenter GPU reads the same weights once and produces a token for hundreds of conversations at the same time.&#10;This is called batching, and it is where most of the efficiency comes from.&lt;/p&gt;&#10;&lt;p&gt;Artificial Analysis measures this with &lt;a href="https://artificialanalysis.ai/hardware-inference-stack/datacenter" target="_blank" rel="noopener"&gt;AgentPerf&lt;/a&gt;, which replays real coding-agent sessions against datacenter hardware.&#10;It counts how many agents a system can serve while each one still gets at least 60 tokens per second.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Coding agents served per kW of accelerator power, each getting at least 60 tokens per second, from AgentPerf. The datacenter systems all run DeepSeek V4 Pro. The 3090 bar is my machine running Qwen3.8 27B, a much smaller model, with GPU power only, so the comparison favors my machine." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="agentsPerKw"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Coding agents served per kW of accelerator power, each getting at least 60 tokens per second, from AgentPerf. The datacenter systems all run DeepSeek V4 Pro. The 3090 bar is my machine running Qwen3.8 27B, a much smaller model, with GPU power only, so the comparison favors my machine.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;The rack of 36 GB300s serves 20 times more agents per kW than the 8-GPU H200 server.&#10;Part of that is newer chips, and part is software: NVIDIA tuned the B300 and GB300 setups itself, while Artificial Analysis configured the H200 one.&#10;The B300 and the GB300 share both the chip generation and the software.&#10;Most of the gap between those two bars comes from the rack itself: 36 GPUs on one fast interconnect keep more than a thousand agents in flight at once.&#10;My two 3090s serve one conversation at a time.&lt;/p&gt;&#10;&lt;h2 id="4-but-i-have-solar-panels"&gt;4. &amp;ldquo;But I have solar panels&amp;rdquo; &lt;a class="anchor" href="#4-but-i-have-solar-panels" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Solar power is not free.&#10;With net metering, every kWh my GPUs burn is a kWh that does not get credited at the retail price.&#10;Without net metering, it is a kWh I do not sell, unless the surplus would go to waste anyway, which is the free-power case below.&#10;And the GPUs also run at night.&lt;/p&gt;&#10;&lt;p&gt;But fine, say the electricity is free and the only cost is the hardware.&#10;I was lucky and bought my two 3090s for about $750 each,&lt;sup id="fnref:5"&gt;&lt;a href="#fn:5" class="footnote-ref" role="doc-noteref"&gt;5&lt;/a&gt;&lt;/sup&gt; and I write them off over three years.&#10;The GPUs only save money while they do work I would otherwise pay an API for, and while they sit idle they save nothing.&#10;So the question is how many hours a day they have to be busy before they pay for themselves.&lt;sup id="fnref:6"&gt;&lt;a href="#fn:6" class="footnote-ref" role="doc-noteref"&gt;6&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;&#10;&lt;p&gt;To make this fair to open models, imagine an open model that is exactly as efficient as Luna: the same quality from the same number of tokens, sold at Luna&amp;rsquo;s price.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="How many hours a day my two $750 RTX 3090s have to be busy, every day for three years, before they cost less than a ZDR API. The host PC is not counted." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="breakEven"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;How many hours a day my two $750 RTX 3090s have to be busy, every day for three years, before they cost less than a ZDR API. The host PC is not counted.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;With free power, the GPUs pay for themselves if they are busy 4 hours a day, every day for three years.&#10;At 18 cents per kWh, they need 8.5.&#10;That uses what I paid for the cards; at today&amp;rsquo;s price of about $1,500 each, the 8.5 hours become 14.&lt;/p&gt;&#10;&lt;p&gt;And API prices keep falling.&#10;GPT-6 Luna costs 58% less per output token than GPT-5.6 Luna did in July.&#10;If the price halves again, no amount of use pays off at 18 cents per kWh.&#10;If it halves twice, the API costs less than my electricity alone.&lt;/p&gt;&#10;&lt;h2 id="5-but-my-mac-dgx-spark-or-ai-max-does-save-money"&gt;5. &amp;ldquo;But my Mac, DGX Spark, or AI Max does save money&amp;rdquo; &lt;a class="anchor" href="#5-but-my-mac-dgx-spark-or-ai-max-does-save-money" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Several readers told me their machines do save them money: a MacBook Pro with an M5 Max, an NVIDIA DGX Spark, and a computer with AMD&amp;rsquo;s Ryzen AI Max+ 395.&#10;If you would have bought the machine anyway, that is true, for the reason in section 2: their electricity costs little compared with the API.&#10;Counting the hardware is a different story.&lt;/p&gt;&#10;&lt;p&gt;With 128 GB of memory, all three can hold a better model than my 3090s: Qwen3.8-Flash-Next, a sparse model with 180 billion parameters, of which only 6 billion work on each token.&#10;It scores 39.8, close to GPT-6 Luna on its highest setting (38.1), although at the Q2 a reader uses on their Mac it probably loses a few points.&lt;sup id="fnref:7"&gt;&lt;a href="#fn:7" class="footnote-ref" role="doc-noteref"&gt;7&lt;/a&gt;&lt;/sup&gt;&#10;So how many years would each machine have to run nonstop before it pays for itself?&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Years of nonstop generation before each machine pays for itself, compared with the most efficient API model at a similar score. Each machine runs the best model it can hold." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="paybackYears"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Years of nonstop generation before each machine pays for itself, compared with the most efficient API model at a similar score. Each machine runs the best model it can hold.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;Even with free power, the 128 GB machines need six to ten years.&#10;The AMD machine draws only about 120 W, but it is slow too: one benchmark run of Qwen3.8 27B takes it four and a half months, and almost as much energy as my 3090s.&#10;The RTX PRO 6000 runs the same model about three times as fast but costs about twice as much, so it needs six to nine years.&#10;My 3090s pay off in under two years with free power, which is why the 3090 is still the value king, but at 18 cents per kWh they never do: the electricity for one run already costs more than Luna charges for it.&lt;/p&gt;&#10;&lt;p&gt;Ten years is a long time in AI.&#10;Better and more efficient open models will run on the same machines, but the frontier moves at the same pace, and API prices keep falling.&#10;Hardware gets more efficient too, in datacenters and at home, so a machine bought today also ends up competing with next year&amp;rsquo;s machines.&#10;These numbers only show how far apart the two sides start.&lt;/p&gt;&#10;&lt;h2 id="6-the-bar-keeps-moving"&gt;6. The bar keeps moving &lt;a class="anchor" href="#6-the-bar-keeps-moving" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Section 4&amp;rsquo;s eight and a half hours a day would be easy for me: I run agents for longer than that, just not on Qwen.&#10;When Claude Opus 4.6 came out in February, I was perfectly happy with it.&#10;I thought it was all I would ever need, and I could not have imagined how much better models would get in half a year.&#10;Qwen3.8 27B now scores about the same as Opus 4.6, and I would no longer accept it for coding.&#10;Until GPT-6 Astra came out at the start of September, my go-to was GPT-5.6 Sol, which scores ten points higher than Qwen.&#10;I then used Astra until Claude Opus 5.5 came out less than three weeks later.&#10;Now I don&amp;rsquo;t even accept what was considered the best model a month ago.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Intelligence Index of the best model available on each date, of the models I used as my go-to, and of Qwen&amp;rsquo;s 27B models, which fit on a single 3090. Scores use the xhigh reasoning setting where a model has it." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="frontierGap"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Intelligence Index of the best model available on each date, of the models I used as my go-to, and of Qwen&amp;rsquo;s 27B models, which fit on a single 3090. Scores use the xhigh reasoning setting where a model has it.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;The models that fit on my 3090s keep improving, but they stay about half a year behind the frontier, and my standard moves with the frontier.&lt;/p&gt;&#10;&lt;h2 id="7-a-small-company-has-it-worse"&gt;7. A small company has it worse &lt;a class="anchor" href="#7-a-small-company-has-it-worse" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For me, this is a hobby, and a hobby is allowed to be inefficient.&#10;It gets worse once you try to use self-hosted models seriously, say for a team of ten developers.&lt;/p&gt;&#10;&lt;p&gt;If you stay fully self-hosted and want fast responses at peak, you have to buy hardware for the busiest hour of the year, not for the average one.&#10;The rest of the time, it sits idle.&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="An illustrative week of coding agents for a ten-person team. The hardware has to cover the busiest hour of the year, but a typical week uses only a fraction of it." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="peakLoad"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;An illustrative week of coding agents for a ten-person team. The hardware has to cover the busiest hour of the year, but a typical week uses only a fraction of it.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;In this made-up but realistic week, the team uses 17% of what it paid for, so every token costs about six times more than it would at full load.&#10;You also need a spare GPU for when one dies, and someone who gets paged when it does.&#10;You could queue work or send the peaks to an API, but then you are paying for an API anyway.&lt;/p&gt;&#10;&lt;p&gt;An API provider has the opposite situation.&#10;It serves thousands of customers across every time zone, so its load curve is much flatter than yours.&#10;It fills the nights with discounted batch jobs (Luna&amp;rsquo;s batch tier is half price) and training runs.&#10;And more concurrent requests mean bigger batches, which is where the efficiency from section 3 comes from.&lt;/p&gt;&#10;&lt;h2 id="8-they-lose-money-on-inference-so-prices-will-go-up"&gt;8. &amp;ldquo;They lose money on inference, so prices will go up&amp;rdquo; &lt;a class="anchor" href="#8-they-lose-money-on-inference-so-prices-will-go-up" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Another argument I hear is that API prices are subsidized by investors and will go up once those investors want their money back.&#10;I don&amp;rsquo;t think that holds for inference.&lt;/p&gt;&#10;&lt;p&gt;AgentPerf also reports how many tokens each GPU serves.&#10;On the GB300 rack, one GPU serving DeepSeek V4 Pro handles about 4 million output tokens and 530 million input tokens per hour.&#10;Most of that input is conversation history that coding agents send again with every step.&#10;Providers keep it in a cache and charge less than 1% of the normal input price for it.&lt;/p&gt;&#10;&lt;p&gt;At &lt;a href="https://artificialanalysis.ai/models/deepseek-v4-pro-0424" target="_blank" rel="noopener"&gt;DeepSeek V4 Pro&amp;rsquo;s list prices&lt;/a&gt;, that GPU brings in at least $5.70 per hour, even if every input token is billed at the cache price.&#10;If 5% of the input misses the cache, it brings in about $17.&#10;Renting a B200, the closest GPU with a &lt;a href="https://artificialanalysis.ai/hardware-inference-stack/datacenter" target="_blank" rel="noopener"&gt;published rental price&lt;/a&gt;, costs $3.50 to $5.90 per hour from smaller cloud providers, and that price already includes their profit.&lt;/p&gt;&#10;&lt;p&gt;So the tokens pay for the hardware that serves them, even in the worst case.&#10;This leaves out costs like staff and training, so it does not tell you whether a lab makes money overall.&lt;/p&gt;&#10;&lt;p&gt;The money goes to training, research, free users, and flat-rate subscriptions for heavy users like me.&#10;When I wrote that I used &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;$10,000 worth of API tokens for $200&lt;/a&gt;, that was list price, not what those tokens cost to serve.&lt;/p&gt;&#10;&lt;p&gt;And prices go down, not up.&#10;This is what the same level of intelligence has cost this year:&lt;/p&gt;&#10;&lt;figure class="plot-figure"&gt;&#10; &lt;div class="plot-container" role="img" aria-label="Output price per million tokens for models scoring between 30 and 35 on the Intelligence Index, by release date, as listed by Artificial Analysis. Log scale." data-plot-module="/post/self-hosting-ai-is-not-cheaper/plots.js" data-plot-name="priceDrop"&gt;&lt;/div&gt;&#10; &lt;figcaption&gt;Output price per million tokens for models scoring between 30 and 35 on the Intelligence Index, by release date, as listed by Artificial Analysis. Log scale.&lt;/figcaption&gt;&#10; &lt;noscript&gt;This chart needs JavaScript.&lt;/noscript&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/plot.7cb86dc2e3ef25b56bc93730b2620745a7f02b5715de87f94e61908f60e51690.js" integrity="sha256-fLhtwuPvJbVryTcwsmIHRafwK1cV3of5TmGQj2DlFpA=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&#10;&#10;&lt;p&gt;From Claude Opus 4.6 in February to GPT-6 Luna in September, the output price for this level of intelligence dropped by a factor of 50.&#10;Labs are in a race to the bottom on price.&lt;/p&gt;&#10;&lt;h2 id="9-but-they-sell-your-data"&gt;9. &amp;ldquo;But they sell your data&amp;rdquo; &lt;a class="anchor" href="#9-but-they-sell-your-data" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Some people say APIs are cheap because the provider trains on your data or sells it.&#10;That is why I only used prices from providers that OpenRouter lists as &lt;a href="https://openrouter.ai/docs/features/zdr" target="_blank" rel="noopener"&gt;zero data retention&lt;/a&gt; (ZDR).&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;Provider&lt;/th&gt;&#10;&lt;th&gt;ZDR&lt;/th&gt;&#10;&lt;th&gt;Output ($ per million tokens)&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;OpenAI&lt;/td&gt;&#10;&lt;td&gt;no&lt;/td&gt;&#10;&lt;td&gt;0.50&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;GPT-6 Luna&lt;/td&gt;&#10;&lt;td&gt;Azure&lt;/td&gt;&#10;&lt;td&gt;yes&lt;/td&gt;&#10;&lt;td&gt;0.50&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Qwen3.8 27B&lt;/td&gt;&#10;&lt;td&gt;AkashML (FP8)&lt;/td&gt;&#10;&lt;td&gt;yes&lt;/td&gt;&#10;&lt;td&gt;1.78&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Qwen3.8 27B&lt;/td&gt;&#10;&lt;td&gt;DeepInfra (full precision)&lt;/td&gt;&#10;&lt;td&gt;yes&lt;/td&gt;&#10;&lt;td&gt;1.88&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Qwen3.8 27B&lt;/td&gt;&#10;&lt;td&gt;Alibaba&lt;/td&gt;&#10;&lt;td&gt;no&lt;/td&gt;&#10;&lt;td&gt;2.55&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Qwen3.8 27B&lt;/td&gt;&#10;&lt;td&gt;Cloudflare&lt;/td&gt;&#10;&lt;td&gt;no&lt;/td&gt;&#10;&lt;td&gt;3.20&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Azure serves GPT-6 Luna with zero data retention at the same price as OpenAI.&#10;For Qwen3.8 27B, the cheapest endpoints are all ZDR, and the endpoints without ZDR cost more.&#10;The &lt;code&gt;:free&lt;/code&gt; tier is where you pay with your data.&lt;/p&gt;&#10;&lt;h2 id="10-where-self-hosting-does-win-the-same-model"&gt;10. Where self-hosting does win: the same model &lt;a class="anchor" href="#10-where-self-hosting-does-win-the-same-model" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;If you compare running Qwen3.8 27B yourself with paying for Qwen3.8 27B through an API, self-hosting wins.&lt;/p&gt;&#10;&lt;p&gt;DeepInfra, the cheapest full-precision ZDR provider, charges $619 for one benchmark run, while my electricity costs $83.&#10;That compares the full model with my quantized copy, so the gap overstates my advantage by whatever quantization costs in quality.&#10;My machine pays for itself if it is busy 2.4 hours a day, or 1.5 hours with free power (the first group in the chart in section 4).&lt;/p&gt;&#10;&lt;p&gt;Providers charge a lot for a dense 27B model, because every token runs through all 27 billion parameters.&#10;Sparse open models, which use only a small part of their weights for each token, can be much cheaper to serve.&#10;If you specifically need Qwen and use it heavily, self-hosting it pays off.&#10;But you don&amp;rsquo;t need Qwen to get answers of Qwen&amp;rsquo;s quality.&#10;Luna gives you those for $67, with zero data retention.&lt;/p&gt;&#10;&lt;h2 id="11-so-why-do-i-do-it"&gt;11. So why do I do it? &lt;a class="anchor" href="#11-so-why-do-i-do-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First, it is fun.&#10;I like knowing how the whole stack works, from the drivers in &lt;a href="https://www.nijho.lt/post/llama-nixos/"&gt;my NixOS configuration&lt;/a&gt; to how the layers are split between my two GPUs.&lt;/p&gt;&#10;&lt;p&gt;Second, nobody can take it away.&#10;Artificial Analysis already lists GPT-5.6 Luna as deprecated, less than three months after its release.&#10;My Qwen weights will still be on my disk in ten years, and no company can change their license or &lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;close their build system&lt;/a&gt; on me.&lt;/p&gt;&#10;&lt;p&gt;Third, some data should not leave my house.&#10;I would never send 200 GB of email, my messages, and my location history to an API, zero data retention or not.&#10;That is what &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;my local AI projects&lt;/a&gt; are for.&lt;/p&gt;&#10;&lt;p&gt;Those are good reasons.&#10;Saving money is not one of them.&lt;/p&gt;&#10;&lt;h2 id="appendix-all-assumptions"&gt;Appendix: all assumptions &lt;a class="anchor" href="#appendix-all-assumptions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;Show all assumptions, and which side each one favors&lt;/summary&gt;&#10; &lt;p&gt;&lt;strong&gt;Assumptions that favor self-hosting&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The host PC around the GPUs is not counted, and my 3090s count at the $750 each I paid, not the $1,500 they sell for today.&lt;/li&gt;&#10;&lt;li&gt;Quantized local copies get the score Artificial Analysis measured through an API, with no penalty for quantization.&lt;/li&gt;&#10;&lt;li&gt;The payback chart assumes each machine is busy 24 hours a day, with no idle time.&lt;/li&gt;&#10;&lt;li&gt;API prices stay where they are, although GPT-6 Luna&amp;rsquo;s output price is 58% lower than GPT-5.6 Luna&amp;rsquo;s, two and a half months earlier.&lt;/li&gt;&#10;&lt;li&gt;My time to set up and maintain the machine is not counted.&lt;/li&gt;&#10;&lt;li&gt;Every machine also gets a case with free electricity.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Assumptions that favor the API&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The example electricity price is 18 cents per kWh, and some people pay less.&lt;/li&gt;&#10;&lt;li&gt;My machine serves one request at a time; batching several requests could raise its total throughput.&lt;/li&gt;&#10;&lt;li&gt;The hardware has no resale value at the end.&lt;/li&gt;&#10;&lt;li&gt;Waste heat that replaces heating in winter is not counted.&lt;/li&gt;&#10;&lt;li&gt;API outages, rate limits, and deprecated models are not counted.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Inputs&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Benchmark: the Artificial Analysis Intelligence Index on September 30, 2026, at the xhigh reasoning setting, or the highest setting where noted. Its token counts per model are the unit of work.&lt;/li&gt;&#10;&lt;li&gt;API prices: the cheapest zero-data-retention endpoints on OpenRouter, with cached input billed at the cache price.&lt;/li&gt;&#10;&lt;li&gt;My machine: two RTX 3090s capped at 270 W, running Qwen3.8 27B in vLLM with AutoRound INT4 and DFlash2. Measured: 107 tokens per second, 1,600 tokens per second of prefill, and 540 W for both GPUs. Estimated: about 700 W for the whole machine under load and 150 W idle.&lt;/li&gt;&#10;&lt;li&gt;Break-even: the cards are written off over three years; busy hours save what the API would charge minus the electricity, and idle hours cost the idle power.&lt;/li&gt;&#10;&lt;li&gt;Other machines: prices, power, and speeds as in the footnotes. The M5 Max and RTX PRO 6000 numbers come from readers, and the DGX Spark and AMD Ryzen AI Max+ 395 speeds are estimated from Artificial Analysis measurements.&lt;/li&gt;&#10;&lt;li&gt;Datacenter: AgentPerf measures accelerator power only, and the B200 rental price stands in for the GB300, which has no published rental price.&lt;/li&gt;&#10;&lt;li&gt;Small company: the peak-load week is made up.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;div class="footnotes" role="doc-endnotes"&gt;&#10;&lt;hr&gt;&#10;&lt;ol&gt;&#10;&lt;li id="fn:1"&gt;&#10;&lt;p&gt;For each model, Artificial Analysis publishes how many input and output tokens the whole index took, and how many of the input tokens were read from a cache. I multiplied those by each provider&amp;rsquo;s prices, with cached input at the cache price. For Qwen that is 198 million output tokens and 820 million input tokens that miss the cache. For the bars at home, the same tokens divided by the machine&amp;rsquo;s speed give the run time, with the uncached input processed at the 1,600 tokens per second I measured on my 3090s and an estimated 2,000 on the RTX PRO 6000, and the run time times the machine&amp;rsquo;s power and the price per kWh gives the electricity.&amp;#160;&lt;a href="#fnref:1" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:2"&gt;&#10;&lt;p&gt;The RTX PRO 6000 has the same memory bandwidth as an RTX 5090, and at full precision every token reads three times as many bytes as in Q4_K_M. Scaling Artificial Analysis&amp;rsquo;s 5090 measurement gives about 48 tokens per second. I assume 600 W for the whole machine.&amp;#160;&lt;a href="#fnref:2" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:3"&gt;&#10;&lt;p&gt;I measured the model as I normally run it: vLLM with an AutoRound INT4 quant and DFlash2 speculative decoding, split across both cards. Single 1,500-token answers came out at 105 to 109 tokens per second, and reading a 22,000-token prompt ran at 1,600 tokens per second. Sending 2, 4, or 8 requests at once did not raise the total above about 110 tokens per second. The two GPUs drew 540 W together, each at its 270 W power limit; the 700 W adds my estimate for the rest of the machine, since I could not measure the CPU. The setup follows the recipes from &lt;a href="https://github.com/noonghunna/club-3090" target="_blank" rel="noopener"&gt;club-3090&lt;/a&gt;, a community project that tunes LLM serving for RTX 3090s and publishes measured numbers, so I think it is about as fast as these cards get. Its benchmarks for this configuration at a similar power limit match mine: about 110 tokens per second for prose, and up to about 195 for code, where speculative decoding guesses more tokens right. Most of Qwen&amp;rsquo;s output on the benchmark is reasoning, which runs at the prose speed.&amp;#160;&lt;a href="#fnref:3" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:4"&gt;&#10;&lt;p&gt;The stock limit is 350 W. My cards sit in a &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;normal desktop case with normal fans&lt;/a&gt;, and I worry that running both at full power for hours would shorten their life. The cap is &lt;a href="https://github.com/basnijholt/dotfiles/blob/e63a3f341ff36b7b57bf31361c2844e1d8b78e95/configs/nixos/hosts/pc/nvidia-undervolt.nix#L1-L7" target="_blank" rel="noopener"&gt;a few lines in my NixOS configuration&lt;/a&gt;, and measurements from Puget Systems and r/LocalLLaMA put a 3090 at about 95% of its speed at 270 W. That is 77% of the power for 95% of the speed, so the cap also lowers my electricity cost per token.&amp;#160;&lt;a href="#fnref:4" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:5"&gt;&#10;&lt;p&gt;The 3090 is still the value king for VRAM per dollar, and $750 badly understates what mine are worth. That is what I paid more than a year ago; today a used 3090 sells for about $1,500. Even at that price it costs $62.50 per GB of VRAM, the same as an RTX 5090 at its $2,000 launch price, which is not what a 5090 sells for today. The right number for this calculation is what I could sell my cards for, and at $1,500 each the break-even points rise by about two thirds: at 18 cents per kWh, the same-model case moves from 2.4 to 4.0 hours per day, and the Luna-efficient case from 8.5 to 14.2 hours per day.&amp;#160;&lt;a href="#fnref:5" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:6"&gt;&#10;&lt;p&gt;While the cards are busy, they save what the API would have charged for the same work, minus the electricity at 700 W. While they are idle, the machine still draws about 150 W, of which the two GPUs with the model loaded take 85 W. The break-even point is the number of busy hours per day at which those savings cover the price of the cards, written off over three years, plus the idle power.&amp;#160;&lt;a href="#fnref:6" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li id="fn:7"&gt;&#10;&lt;p&gt;The M5 Max numbers come from the reader: Qwen3.8-Flash-Next at Q2 (about 2.7 bits per weight), about 45 tokens per second, 1,250 tokens per second of prefill, and about 90 W, on a $7,000 laptop. The RTX PRO 6000 numbers come from another reader, &lt;a href="https://www.reddit.com/r/LocalLLaMA/comments/1ww2jsu/comment/pdhs3ea/" target="_blank" rel="noopener"&gt;u/TheAILegend&lt;/a&gt;, who measured Qwen3.8-Flash-Next at NVFP4 on theirs. For a single request, it stays at about 150 tokens per second from 4,000 to 200,000 tokens of context, with about 10,000 tokens per second of prefill and 266 W for the GPU plus about 160 W for the rest of the PC. With 32 short requests in parallel, the card reaches 590 tokens per second and pays off in about two years, which works for short batch jobs. At the long contexts of this benchmark, parallel requests are slower than one, so the chart uses the single-request speed. I use $15,000, the middle of the card&amp;rsquo;s price range. The DGX Spark and the AMD machine run Qwen3.8-Flash-Next at about 4.5 bits. For their speed, I took Artificial Analysis&amp;rsquo;s measurements of Qwen3.8 27B on each machine and doubled them, because the owner of the AMD machine finds Qwen3.8-Flash-Next about twice as fast as Qwen3.8 27B. That gives about 55 tokens per second on the DGX Spark ($6,950, about 150 W) and 47 on the AMD Ryzen AI Max+ 395 ($4,000, the price Artificial Analysis lists, about 120 W). All of them are compared with GPT-6 Luna on its highest setting, which runs the whole benchmark for $122. The 3090s run Qwen3.8 27B, as in the rest of this post, and are compared with Luna on xhigh. Artificial Analysis measured Qwen3.8 27B on the AMD machine at 23 tokens per second, so one benchmark run takes it 134 days and about 390 kWh, against about 460 kWh on my 3090s. Running Qwen3.8-Flash-Next on the 3090s with CPU expert offload, which club-3090 measured at 37 tokens per second, does not change their result: one run then takes 82 days, and at 18 cents per kWh its electricity costs more than Luna&amp;rsquo;s $122 unless the whole machine draws less than about 350 W.&amp;#160;&lt;a href="#fnref:7" class="footnote-backref" role="doc-backlink"&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/div&gt;&#10;</description></item><item><title>Friend-to-friend ZFS backups, version two</title><link>https://www.nijho.lt/post/zfs-tenant/</link><pubDate>Mon, 28 Sep 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/zfs-tenant/</guid><description>&lt;p&gt;Two years ago I wrote about &lt;a href="https://www.nijho.lt/post/truenas-remote-backups/"&gt;friend-to-friend backups with TrueNAS&lt;/a&gt;.&#10;A friend and I store each other&amp;rsquo;s ZFS snapshots, which is the cheapest off-site backup there is.&#10;TrueNAS&amp;rsquo;s replication tasks wanted root on the receiving system, and neither of us wanted to give the other root on the machine that holds our family photos.&#10;So each of us ran a TrueNAS VM on a hypervisor, backed by an iSCSI zvol on the real NAS, and gave the other person root inside that VM instead.&#10;Sounds complicated?&#10;It was.&#10;It worked, but it meant running ZFS on a zvol on ZFS, inside a VM that each of us had to keep updated.&lt;/p&gt;&#10;&lt;p&gt;Since then I &lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;replaced TrueNAS with NixOS&lt;/a&gt;, and my friend plans to move his machines to NixOS too.&#10;This time we looked for the simplest solution, built from standard Linux and ZFS features wherever possible.&#10;He wanted plain &lt;code&gt;zfs send&lt;/code&gt; and &lt;code&gt;zfs receive&lt;/code&gt;, with his data still encrypted and his keys never on my server.&#10;I agreed, on one condition: neither of us should be able to destroy the other&amp;rsquo;s datasets.&lt;/p&gt;&#10;&lt;p&gt;The result is &lt;a href="https://github.com/basnijholt/zfs-tenant" target="_blank" rel="noopener"&gt;zfs-tenant&lt;/a&gt;, which is now &lt;a href="https://pypi.org/project/zfs-tenant/" target="_blank" rel="noopener"&gt;on PyPI&lt;/a&gt; and has &lt;a href="https://zfs-tenant.nijho.lt" target="_blank" rel="noopener"&gt;documentation&lt;/a&gt;.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/zfs-tenant/logo.svg" width="220" alt="The zfs-tenant logo: a storage pool with two dim compartments for the host and one locked amber compartment for a friend, filled up to a dashed quota line" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#why-zfs"&gt;Why ZFS&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-we-wanted"&gt;What we wanted&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#zfs-already-had-most-of-it"&gt;ZFS already had most of it&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#rehearsing-the-permissions-in-a-vm"&gt;Rehearsing the permissions in a VM&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#a-gate-that-speaks-syncoid"&gt;A gate that speaks syncoid&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#zones-a-second-wall-in-the-kernel"&gt;Zones: a second wall in the kernel&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#who-stops-what"&gt;Who stops what&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-it-cannot-hide"&gt;What it cannot hide&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#setting-it-up"&gt;Setting it up&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#knowing-when-it-stops-working"&gt;Knowing when it stops working&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#restoring"&gt;Restoring&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-first-real-push"&gt;The first real push&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#tested-like-everything-else"&gt;Tested like everything else&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#ai-scope-creep-or-useful"&gt;AI scope creep or useful?&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#references"&gt;References&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="why-zfs"&gt;Why ZFS &lt;a class="anchor" href="#why-zfs" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://openzfs.org/" target="_blank" rel="noopener"&gt;OpenZFS&lt;/a&gt; is a filesystem and a volume manager in one.&#10;You add disks to a pool, and it behaves like one large partition: every dataset you create draws from the same free space, and each can still have its own quota and encryption.&#10;ZFS checksums every block it writes, so it notices when a disk hands back something else, and with a mirror or RAIDZ it repairs the block from a good copy.&#10;That protection costs disk space: a mirror of two disks holds one disk&amp;rsquo;s worth of data.&lt;/p&gt;&#10;&lt;p&gt;For me, snapshots are one of the coolest parts.&#10;ZFS never overwrites data in place, so a snapshot only has to hold on to the blocks that existed at that moment.&#10;Taking one is instant, and it costs no space until the data changes.&#10;&lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-send.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs send&lt;/code&gt;&lt;/a&gt; turns a snapshot, or the difference between two snapshots, into a stream that &lt;code&gt;zfs receive&lt;/code&gt; writes into a pool on another machine, usually piped through SSH.&#10;It moves blocks, not files: an incremental send contains only the blocks that changed, and ZFS knows which ones those are without visiting a single file.&#10;A bajillion one-kilobyte files do not slow it down, because nothing has to look at them one by one.&#10;For comparison, restic on my PC needed &lt;a href="https://www.nijho.lt/post/btrfs-to-zfs/"&gt;an hour and a half per run&lt;/a&gt; just to check close to a hundred million files for changes.&lt;/p&gt;&#10;&lt;p&gt;Two tools from the same project automate this.&#10;&lt;a href="https://github.com/jimsalterjrs/sanoid" target="_blank" rel="noopener"&gt;sanoid&lt;/a&gt; takes snapshots on a schedule and prunes them by policy, for example hourly ones for a day and daily ones for a month.&#10;syncoid wraps &lt;code&gt;zfs send&lt;/code&gt; and &lt;code&gt;zfs receive&lt;/code&gt; over SSH: it finds the newest snapshot both sides share and sends everything after it.&lt;/p&gt;&#10;&lt;h2 id="what-we-wanted"&gt;What we wanted &lt;a class="anchor" href="#what-we-wanted" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;We wrote down the rules before anything else:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;He cannot see any of my data, including metadata like dataset names and sizes.&lt;/li&gt;&#10;&lt;li&gt;He cannot change or destroy anything of mine.&lt;/li&gt;&#10;&lt;li&gt;I cannot read his data, because his keys stay at his house.&lt;/li&gt;&#10;&lt;li&gt;He gets one dataset where he can create and remove nested datasets as he likes.&lt;/li&gt;&#10;&lt;li&gt;That dataset has a size limit.&lt;/li&gt;&#10;&lt;li&gt;No new replication tool on either side: plain &lt;code&gt;zfs send&lt;/code&gt; or syncoid.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Until then his NAS runs TrueNAS, so whatever I built also had to work on a machine without NixOS.&lt;/p&gt;&#10;&lt;h2 id="zfs-already-had-most-of-it"&gt;ZFS already had most of it &lt;a class="anchor" href="#zfs-already-had-most-of-it" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;OpenZFS has a permission system that most people never touch: &lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-allow.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs allow&lt;/code&gt;&lt;/a&gt;.&#10;It delegates individual operations like &lt;code&gt;receive&lt;/code&gt;, &lt;code&gt;create&lt;/code&gt;, and &lt;code&gt;destroy&lt;/code&gt; on one dataset to an unprivileged user.&#10;Put a root-owned &lt;code&gt;quota&lt;/code&gt; on that dataset and the user cannot store more than you agreed.&#10;Raw sends (&lt;code&gt;zfs send -w&lt;/code&gt;) ship the encrypted blocks as they are, so the receiving side never needs the key.&lt;/p&gt;&#10;&lt;p&gt;On paper, that covers five of the six rules.&#10;The gap is visibility.&#10;Any local user can run &lt;code&gt;zfs list&lt;/code&gt; and see every dataset on the machine, with names, sizes, and properties.&#10;And an SSH account for replication is, by default, also a shell.&lt;/p&gt;&#10;&lt;p&gt;There are tools that would sidestep some of this.&#10;&lt;a href="https://zrepl.github.io/" target="_blank" rel="noopener"&gt;zrepl&lt;/a&gt; has a sink mode with a subtree per client, but it replaces sanoid and syncoid on both sides and runs as root on the receiver.&#10;restic or borg to a friend&amp;rsquo;s box would also work, but everything else on my network is ZFS: my machines &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/replication.nix#L40-L49" target="_blank" rel="noopener"&gt;replicate to the NAS with syncoid&lt;/a&gt;, and a restore is &lt;code&gt;zfs send&lt;/code&gt; and &lt;code&gt;zfs receive&lt;/code&gt;.&#10;Adding another backup format means one more thing to understand when something breaks.&#10;My current off-site copy goes to &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/docker-lxc/rclone-b2-backup.nix" target="_blank" rel="noopener"&gt;Backblaze B2 with rclone&lt;/a&gt;.&#10;Ideally that would be ZFS as well, and some hosting services accept &lt;code&gt;zfs send&lt;/code&gt;, but they cost far more than object storage.&#10;A friend with a ZFS box costs nothing.&lt;/p&gt;&#10;&lt;h2 id="rehearsing-the-permissions-in-a-vm"&gt;Rehearsing the permissions in a VM &lt;a class="anchor" href="#rehearsing-the-permissions-in-a-vm" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Before writing any code, I had an agent build a throwaway NixOS VM test with a real pool, a delegated user, and a list of probes.&#10;Each probe tried one thing the friend should not be able to do and recorded what ZFS answered.&lt;/p&gt;&#10;&lt;p&gt;The first surprise came from the most obvious setup.&#10;With a plain &lt;code&gt;zfs allow -u joe create,receive,destroy,... tank/friends/joe&lt;/code&gt;, the delegated user could run &lt;code&gt;zfs destroy -r tank/friends/joe&lt;/code&gt; and delete the dataset I had created for him, quota included.&#10;Delegated rights apply to the dataset itself as well as everything below it, unless you say otherwise.&#10;The fix is to split them: on the root itself only &lt;code&gt;create,mount,receive&lt;/code&gt; with &lt;code&gt;zfs allow -l&lt;/code&gt;, and the full set only for descendants with &lt;code&gt;zfs allow -d&lt;/code&gt;.&#10;After that change, destroying, snapshotting, re-delegating, or changing the quota of the root all failed with &lt;code&gt;permission denied&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;A send stream can carry properties too, such as a hostile &lt;code&gt;mountpoint=/etc&lt;/code&gt;.&#10;ZFS applies them with the receiving user&amp;rsquo;s rights, so in the VM that property failed with &lt;code&gt;permission denied&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;The probes also confirmed the gap: the delegated user saw my &lt;code&gt;tank/host&lt;/code&gt; dataset in &lt;code&gt;zfs list&lt;/code&gt;, and &lt;code&gt;zfs get used tank/host&lt;/code&gt; returned its size.&lt;/p&gt;&#10;&lt;h2 id="a-gate-that-speaks-syncoid"&gt;A gate that speaks syncoid &lt;a class="anchor" href="#a-gate-that-speaks-syncoid" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The shell part has a standard answer.&#10;An &lt;code&gt;authorized_keys&lt;/code&gt; line with &lt;code&gt;restrict,command=&amp;quot;...&amp;quot;&lt;/code&gt; runs one fixed program for every login, and passes whatever the client asked for in &lt;code&gt;SSH_ORIGINAL_COMMAND&lt;/code&gt;.&#10;&lt;code&gt;zfs-tenant gate&lt;/code&gt; is that program.&#10;It tokenizes the request, accepts only the handful of command shapes a backup needs, checks that every dataset name is inside the friend&amp;rsquo;s dataset, and runs &lt;code&gt;zfs&lt;/code&gt; with an argument list it builds itself.&#10;It never starts a shell, so there is nothing to inject into.&lt;/p&gt;&#10;&lt;p&gt;The hard part was knowing exactly which commands syncoid sends, so an agent read &lt;a href="https://github.com/jimsalterjrs/sanoid/blob/v2.3.0/syncoid" target="_blank" rel="noopener"&gt;syncoid&amp;rsquo;s Perl&lt;/a&gt; and logged every remote command it ran.&#10;Most are the &lt;code&gt;zfs&lt;/code&gt; commands you would expect.&#10;One surprise: before each receive, syncoid runs &lt;code&gt;ps -Ao args=&lt;/code&gt; on the receiving machine, to check that no other transfer is already writing to the same dataset.&#10;That command prints every running process with its full command line.&#10;On my NAS, it would show my friend everything I run, so the gate answers with an empty list.&lt;/p&gt;&#10;&lt;p&gt;Reading syncoid that closely also turned up a remote code execution (RCE) bug in version 2.3.0, outside zfs-tenant itself.&#10;In push mode, syncoid asks the receiving host for a ZFS resume token.&#10;It passed that answer unescaped into shell commands for estimating and resuming the send, which run on the source machine.&#10;A malicious or compromised backup host could therefore return shell syntax instead of a token and execute arbitrary commands on the sender with the privileges of the syncoid process.&lt;/p&gt;&#10;&lt;p&gt;I reproduced this in two isolated NixOS VMs using real ZFS and SSH: a harmless command embedded in the receiver&amp;rsquo;s answer created a marker file on the sender.&#10;I reported it to the maintainer and opened &lt;a href="https://github.com/jimsalterjrs/sanoid/pull/1114" target="_blank" rel="noopener"&gt;sanoid PR #1114&lt;/a&gt; with a small fix that shell-quotes the token at both uses.&#10;Even with that fix, the sending side should run syncoid as an unprivileged user that may only &lt;code&gt;send&lt;/code&gt; and &lt;code&gt;hold&lt;/code&gt;.&#10;nixpkgs&amp;rsquo; &lt;code&gt;services.syncoid&lt;/code&gt; already works that way, so my friend needs nothing from zfs-tenant at all.&lt;/p&gt;&#10;&lt;h2 id="zones-a-second-wall-in-the-kernel"&gt;Zones: a second wall in the kernel &lt;a class="anchor" href="#zones-a-second-wall-in-the-kernel" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;At that point the gate was the only thing hiding my datasets.&#10;Then my friend sent me a message: ZFS has a feature called zones, which restricts a dataset tree to a Linux user namespace.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-zone.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs zone&lt;/code&gt;&lt;/a&gt; attaches a dataset to one user namespace, and inside that namespace the ZFS kernel module answers &lt;code&gt;dataset does not exist&lt;/code&gt; for everything that is not attached.&#10;Even if my gate had a bug that let arbitrary &lt;code&gt;zfs&lt;/code&gt; commands through, &lt;code&gt;tank/host&lt;/code&gt; would stay invisible.&#10;The zone does not replace the gate, though: it only filters ZFS, and it only applies once the gate has put the SSH session inside it.&#10;&lt;a href="#who-stops-what"&gt;Who stops what&lt;/a&gt; shows how the two divide the work.&lt;/p&gt;&#10;&lt;p&gt;A user namespace can give its processes different user IDs than they have outside.&#10;Containers usually use that to make the user root inside the namespace, while it stays an ordinary user outside.&#10;ZFS treats root inside a zone as the zone&amp;rsquo;s administrator, allowed to do anything to the attached datasets, whatever &lt;code&gt;zfs allow&lt;/code&gt; says.&#10;In the VM test, that let the friend destroy the dataset I had created for him.&#10;So zfs-tenant keeps him as his own ordinary user inside the namespace: he has no special rights there, &lt;code&gt;zfs allow&lt;/code&gt; decides what he may do, and the kernel still hides everything else.&lt;/p&gt;&#10;&lt;p&gt;Root inside a user namespace also turned up in a real OpenZFS bug in August: before 2.4.4, 2.3.9, and 2.2.11, several pool operations, such as destroying a pool, accepted it as host root (&lt;a href="https://github.com/openzfs/zfs/security/advisories/GHSA-mhf5-q8gw-qg9v" target="_blank" rel="noopener"&gt;CVE-2026-79619&lt;/a&gt;).&#10;Joe cannot reach that through the gate, but zfs-tenant needs unprivileged user namespaces, so a host running it should load a patched module: &lt;code&gt;cat /sys/module/zfs/version&lt;/code&gt; shows the loaded one, which only changes after a reboot.&lt;/p&gt;&#10;&lt;p&gt;A zone needs a running namespace to attach to, so zfs-tenant runs a small service per friend that holds one.&#10;The gate joins that namespace before it looks at the command, drops the capabilities that joining grants, and refuses to run if the service is down.&lt;/p&gt;&#10;&lt;h2 id="who-stops-what"&gt;Who stops what &lt;a class="anchor" href="#who-stops-what" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When Joe and I talked it through, I found it hard to say clearly which part protects against what, so I made this diagram.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/zfs-tenant/layers.svg" alt="Diagram of seven things Joe&amp;#39;s key tries and the layer that stops each one: the network, the SSH gate, the zone, and zfs allow with the quota. Only his raw encrypted backup reaches my pool, where it stays unreadable to me." loading="lazy" data-zoomable&gt;&lt;/figure&gt;&#10;&lt;p&gt;Each column answers one question: who can connect, what he can run, what ZFS shows him, and what he can change.&#10;For the network, our tailnet only lets his router reach port 22 on my NAS, and &lt;code&gt;from=&lt;/code&gt; in &lt;code&gt;authorized_keys&lt;/code&gt; only accepts his key from that address.&#10;Raw sends then keep whatever reaches my pool unreadable to me.&lt;/p&gt;&#10;&lt;p&gt;The gate and the zone overlap in one job: hiding my other datasets.&#10;The gate does it first, by refusing any name outside his root before &lt;code&gt;zfs&lt;/code&gt; runs.&#10;The zone repeats that check in the kernel, so hiding my datasets would take a bug in both.&#10;Everything else the gate does, the zone cannot:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Without the gate, his key would be a normal account on my NAS. The zone only filters ZFS; it would not stop him from reading &lt;code&gt;/etc&lt;/code&gt; or running programs.&lt;/li&gt;&#10;&lt;li&gt;An SSH login does not start inside a user namespace. The gate joins the zone before it runs anything, so without the gate the zone would never apply.&lt;/li&gt;&#10;&lt;li&gt;The zone leaves some things visible: &lt;code&gt;zpool status&lt;/code&gt; still shows my disks and how full the pool is, and the datasets above his root still show their sizes. User namespaces do not hide processes either, hence the empty answer to &lt;code&gt;ps&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;It deletes any unencrypted dataset he pushes by mistake, so I never keep his plaintext.&lt;/li&gt;&#10;&lt;li&gt;It logs every command, which is how I saw Joe try &lt;code&gt;bash&lt;/code&gt; below.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The &lt;a href="https://zfs-tenant.nijho.lt/security/" target="_blank" rel="noopener"&gt;security model&lt;/a&gt; in the documentation lists every promise with the mechanism behind it.&lt;/p&gt;&#10;&lt;h2 id="what-it-cannot-hide"&gt;What it cannot hide &lt;a class="anchor" href="#what-it-cannot-hide" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;ZFS encryption protects file contents, not structure.&#10;In the words of &lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-load-key.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs-load-key(8)&lt;/code&gt;&lt;/a&gt;, ZFS &amp;ldquo;will not encrypt metadata related to the pool structure, including dataset and snapshot names, dataset hierarchy, properties, file size, file holes, and deduplication tables.&amp;rdquo;&#10;So I can see the names, sizes, and snapshot times of whatever my friend sends me.&#10;Boring dataset names help, and sending without &lt;code&gt;-p&lt;/code&gt; keeps properties out of the stream.&lt;/p&gt;&#10;&lt;p&gt;I can also always delete his copy, because I am root on my own machine.&#10;What I can never do is read it.&#10;My &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/storage.nix#L71-L81" target="_blank" rel="noopener"&gt;monthly scrubs&lt;/a&gt; still verify his data without his key, because ZFS checksums the encrypted blocks.&lt;/p&gt;&#10;&lt;p&gt;What we protect against is a dead machine: a failed pool, a fire, a flood.&#10;His key may destroy anything below his root, which is what lets syncoid mirror his snapshot retention, so someone who steals that key can also delete his backups on my NAS.&#10;Covering that would take holds that I place as root and release on a schedule.&#10;We left them out on purpose, although I am &lt;a href="#ai-scope-creep-or-useful"&gt;reconsidering&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="setting-it-up"&gt;Setting it up &lt;a class="anchor" href="#setting-it-up" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;On a NixOS host, giving a friend space takes this:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zfs-tenant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;tenants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;joe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;dataset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;tank/friends/joe&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;quota&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;2T&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;authorizedKeys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... joe-nas&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;allowedFrom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;100.64.0.12&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt; &lt;span class="c1"&gt;# his tailnet address&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That creates the user, pins the key to the gate, applies the dataset, properties, and delegation on every boot, and runs the zone service.&#10;My own setup is in &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/friend-backups.nix#L43-L50" target="_blank" rel="noopener"&gt;&lt;code&gt;friend-backups.nix&lt;/code&gt;&lt;/a&gt;, with his real key and address.&#10;If your sanoid snapshots the whole pool, &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/friend-backups.nix#L52-L59" target="_blank" rel="noopener"&gt;exclude the tenant tree&lt;/a&gt;: your sanoid must neither snapshot nor prune it, or his next incremental push finds snapshots on the target that he never sent.&#10;Once my friend is on NixOS, he can push with nixpkgs&amp;rsquo; own module:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;programs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ssh&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;knownHosts&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;bas-nas&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;publicKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA...&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;syncoid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;sshKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/var/lib/syncoid/id_ed25519&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;localSourceAllow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;send&amp;#34;&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;hold&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;commonArgs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;--no-sync-snap&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;--compress=none&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;--delete-target-snapshots&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;--sshoption=StrictHostKeyChecking=yes&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;commands&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;tank/offsite&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;zfs-tenant-joe@bas-nas:tank/friends/joe/offsite&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;recursive&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;sendOptions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;w&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;My NAS will push to his with the &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/friend-backups.nix#L66-L91" target="_blank" rel="noopener"&gt;same configuration&lt;/a&gt; once he hosts a root for me.&lt;/p&gt;&#10;&lt;p&gt;For his TrueNAS box, every &lt;a href="https://github.com/basnijholt/zfs-tenant/releases" target="_blank" rel="noopener"&gt;release&lt;/a&gt; has a single &lt;code&gt;zfs-tenant.pyz&lt;/code&gt; that runs with the Python TrueNAS already ships, and the &lt;a href="https://zfs-tenant.nijho.lt/getting-started/" target="_blank" rel="noopener"&gt;getting started guide&lt;/a&gt; covers both setups.&#10;Hosting on TrueNAS has only run in VMs so far (&lt;a href="https://github.com/basnijholt/zfs-tenant/issues/4" target="_blank" rel="noopener"&gt;issue #4&lt;/a&gt;).&#10;Sending from TrueNAS is where its built-in tools stop working: replication tasks wrap every remote command in &lt;code&gt;sh -c&lt;/code&gt;, which the gate refuses, so he pushes with &lt;code&gt;zfs send&lt;/code&gt; or syncoid instead.&lt;/p&gt;&#10;&lt;h2 id="knowing-when-it-stops-working"&gt;Knowing when it stops working &lt;a class="anchor" href="#knowing-when-it-stops-working" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;a href="https://www.nijho.lt/post/btrfs-to-zfs/"&gt;last btrfs machine&lt;/a&gt; taught me a fifth question for any backup: how do I find out when it stops working?&#10;A failed push shows up in &lt;code&gt;systemctl status&lt;/code&gt; on the sending side, which nobody reads.&#10;The check belongs on the receiving side, and it has to look at every pushed dataset separately, because one healthy dataset can hide another that stopped replicating.&#10;That is how I watch my own machines: the NAS &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/replication.nix#L332-L352" target="_blank" rel="noopener"&gt;checks the newest snapshot of every dataset it replicates&lt;/a&gt; every hour and alerts my phone when one is too old.&#10;zfs-tenant does not alert yet; &lt;a href="https://github.com/basnijholt/zfs-tenant/issues/3" target="_blank" rel="noopener"&gt;issue #3&lt;/a&gt; tracks it.&lt;/p&gt;&#10;&lt;h2 id="restoring"&gt;Restoring &lt;a class="anchor" href="#restoring" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The gate also allows &lt;code&gt;zfs send&lt;/code&gt; of his own snapshots, so getting data back is one pipe, run at his house:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ssh zfs-tenant-joe@bas-nas zfs send -w tank/friends/joe/offsite/photos@autosnap_2026-09-25_00:00:01_daily &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;|&lt;/span&gt; zfs receive -u tank/photos&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zfs load-key tank/photos&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;zfs mount tank/photos&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;My photos are a child dataset that inherits its key from an encryption root, and I only push the child.&#10;If my NAS dies and I pull the child back, can I still unlock it without the root?&#10;A throwaway VM says yes: a raw send carries the dataset&amp;rsquo;s own wrapped key, so the child arrives as its own encryption root and opens with the same passphrase.&#10;The one catch: after a &lt;code&gt;zfs change-key&lt;/code&gt;, the next push carries the new wrapping, so the passphrase that matters is the one at the time of the last push, and it has to live somewhere other than the NAS.&#10;Mine does: &lt;a href="https://github.com/basnijholt/zfs-unlock" target="_blank" rel="noopener"&gt;zfs-unlock&lt;/a&gt; keeps the passphrases on a separate device and &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/zfs-unlock.nix" target="_blank" rel="noopener"&gt;unlocks the NAS&lt;/a&gt; after every boot.&lt;/p&gt;&#10;&lt;h2 id="the-first-real-push"&gt;The first real push &lt;a class="anchor" href="#the-first-real-push" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Once &lt;a href="https://github.com/basnijholt/dotfiles/blob/6526b50e9bae1449a915239491099ef71528f10c/configs/nixos/hosts/nas/friend-backups.nix" target="_blank" rel="noopener"&gt;my side was deployed&lt;/a&gt;, Joe tried it from his TrueNAS box.&#10;His first move was to see what else his key could do.&#10;The gate logged every attempt on my NAS:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root=tank/friends/joe denied interactive session&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root=tank/friends/joe denied &amp;#39;ls&amp;#39;: only zfs commands and syncoid&amp;#39;s probes are allowed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root=tank/friends/joe denied &amp;#39;/usr/bin/bash&amp;#39;: only zfs commands and syncoid&amp;#39;s probes are allowed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root=tank/friends/joe denied &amp;#39;/bin/bash&amp;#39;: only zfs commands and syncoid&amp;#39;s probes are allowed&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;root=tank/friends/joe allowed &amp;#39;zfs receive -s -u tank/friends/joe/zt-test&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The last line is a small encrypted test dataset, sent with &lt;code&gt;zfs send -w&lt;/code&gt; piped into &lt;code&gt;ssh&lt;/code&gt;, without syncoid.&#10;It arrived with &lt;code&gt;keystatus&lt;/code&gt; set to &lt;code&gt;unavailable&lt;/code&gt;.&#10;Then I tried to read it as root on my own machine.&#10;&lt;code&gt;zfs mount&lt;/code&gt; answered &lt;code&gt;cannot mount 'tank/friends/joe/zt-test': dataset is exported to a local zone&lt;/code&gt;, and &lt;code&gt;zfs load-key&lt;/code&gt; with a guessed passphrase gave &lt;code&gt;Key load error: Incorrect key provided&lt;/code&gt;.&#10;The only readable text in the raw stream was ZFS property names and the snapshot name, which is the metadata ZFS leaves unencrypted, as described above.&lt;/p&gt;&#10;&lt;h2 id="tested-like-everything-else"&gt;Tested like everything else &lt;a class="anchor" href="#tested-like-everything-else" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Every security claim in this post is also checked by a VM test: two NixOS machines back each other up, the way my friend and I do, with real sanoid and syncoid 2.3.0, through real sshd and the gate, into real OpenZFS 2.4.4.&#10;It also checks what happens over time, such as snapshot retention and both machines rebooting, and it runs on every push in GitHub Actions.&lt;/p&gt;&#10;&lt;p&gt;The route to the &lt;a href="https://github.com/jimsalterjrs/sanoid/pull/1114" target="_blank" rel="noopener"&gt;remote code execution bug in syncoid&lt;/a&gt; was slightly absurd.&#10;I built the initial version of zfs-tenant through coding agents, literally from the bathtub, and then asked several frontier models to review the security boundary independently.&#10;One of them followed receiver-controlled data beyond my new code and into syncoid.&#10;A model&amp;rsquo;s suspicion is not evidence, so I turned it into the two-VM reproduction above: it failed on unpatched syncoid 2.3.0 and passed after the seven-line fix.&#10;The most consequential result of reviewing my small new project was a command-injection bug in the mature tool next to it.&lt;/p&gt;&#10;&lt;p&gt;The whole thing is about 930 lines of Python, not counting comments and docstrings, with no dependencies.&#10;The kernel does the actual enforcing: delegation, the quota, and the zone.&#10;The gate only removes the shell, and it is small enough to read in one sitting.&lt;/p&gt;&#10;&lt;h2 id="ai-scope-creep-or-useful"&gt;AI scope creep or useful? &lt;a class="anchor" href="#ai-scope-creep-or-useful" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The first version had &lt;em&gt;grace holds&lt;/em&gt;: every day, the host placed a hold on the newest snapshot of each of my friend&amp;rsquo;s datasets and released it 14 days later.&#10;ZFS will not destroy a held snapshot until the hold is released, and only the host can release it.&#10;The agent built it without me asking for it, so I removed it right away as scope creep.&lt;/p&gt;&#10;&lt;p&gt;Then every model I asked to review the project suggested them again, each in its own context window: Opus 5.5, GPT-6 Astra, and even the one that reviewed a draft of this post.&#10;Joe and I had set out to protect against a machine dying (a fire or a flood), not against one of our own machines being hacked.&#10;But I am tempted to add the holds back.&#10;They cover the case where malware or an attacker gets onto my machine and uses my key to delete my backups on his NAS, or to replace them with garbage.&#10;Adding the feature without asking was still wrong; the feature itself might not be.&lt;/p&gt;&#10;&lt;h2 id="references"&gt;References &lt;a class="anchor" href="#references" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/zfs-tenant" target="_blank" rel="noopener"&gt;zfs-tenant on GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://zfs-tenant.nijho.lt" target="_blank" rel="noopener"&gt;zfs-tenant documentation&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/truenas-remote-backups/"&gt;Friend-to-friend TrueNAS backups without the cloud&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;Migrating from TrueNAS to NixOS&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/btrfs-to-zfs/"&gt;The last btrfs machine: migrating my PC to ZFS&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-allow.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs-allow(8)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openzfs.github.io/openzfs-docs/man/master/8/zfs-zone.8.html" target="_blank" rel="noopener"&gt;&lt;code&gt;zfs-zone(8)&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/jimsalterjrs/sanoid" target="_blank" rel="noopener"&gt;Sanoid and syncoid&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>Exploring the Jev hype in MindRoom</title><link>https://www.nijho.lt/post/jev-mindroom/</link><pubDate>Wed, 23 Sep 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/jev-mindroom/</guid><description>&lt;p&gt;Last week, every AI newsletter I get was full of &lt;a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" target="_blank" rel="noopener"&gt;Jev&lt;/a&gt;, a new model from TypeSafe.&#10;So were several subreddits.&#10;I am a permanent lurker on &lt;a href="https://www.reddit.com/r/LocalLLaMA/" target="_blank" rel="noopener"&gt;r/LocalLLaMA&lt;/a&gt;, and even though it is about local models, every other post seemed to be about Jev.&#10;There were local clones like &lt;a href="https://github.com/r-ms/mini-jev" target="_blank" rel="noopener"&gt;mini-jev&lt;/a&gt; and &lt;a href="https://github.com/wfzyx/von" target="_blank" rel="noopener"&gt;von&lt;/a&gt;, CLI wrappers like &lt;a href="https://github.com/joshLong145/jev-cli" target="_blank" rel="noopener"&gt;jev-cli&lt;/a&gt;, and even &lt;a href="https://news.ycombinator.com/item?id=49765348" target="_blank" rel="noopener"&gt;someone on Hacker News&lt;/a&gt; claiming &lt;a href="https://laya.convaiinnovations.com/" target="_blank" rel="noopener"&gt;they had built the same thing a year earlier&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;I tried Jev in &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom&lt;/a&gt;, my &lt;a href="https://github.com/mindroom-ai/mindroom" target="_blank" rel="noopener"&gt;open-source&lt;/a&gt; agent platform on &lt;a href="https://matrix.org" target="_blank" rel="noopener"&gt;Matrix&lt;/a&gt;, and less than two days later it was making &lt;a href="https://github.com/mindroom-ai/mindroom/issues/2156" target="_blank" rel="noopener"&gt;three decisions&lt;/a&gt; there.&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Update 2026-10-07:&lt;/strong&gt; OpenAI released the Decisions API today, its own take on the same idea, and MindRoom now supports it as a third backend; see &lt;a href="#a-third-backend-openai-decisions"&gt;below&lt;/a&gt;.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 id="what-a-system-one-model-is"&gt;What a System One model is &lt;a class="anchor" href="#what-a-system-one-model-is" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;a href="https://docs.typesafe.ai/concepts/system-one" target="_blank" rel="noopener"&gt;name comes&lt;/a&gt; from Daniel Kahneman&amp;rsquo;s &lt;a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow" target="_blank" rel="noopener"&gt;&lt;em&gt;Thinking, Fast and Slow&lt;/em&gt;&lt;/a&gt;, where System 1 is fast, intuitive thinking and System 2 is slow and deliberate.&#10;A System One model does not generate text.&#10;You send it a state, for example a chat log, plus typed questions, and it returns &lt;a href="https://docs.typesafe.ai/api" target="_blank" rel="noopener"&gt;probabilities&lt;/a&gt;:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Type&lt;/th&gt;&#10;&lt;th&gt;Question&lt;/th&gt;&#10;&lt;th&gt;Answer&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Noul&lt;/td&gt;&#10;&lt;td&gt;Yes or no&lt;/td&gt;&#10;&lt;td&gt;Probability of yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Choice&lt;/td&gt;&#10;&lt;td&gt;Pick one of up to 255 options&lt;/td&gt;&#10;&lt;td&gt;Chosen option plus the full distribution&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Score&lt;/td&gt;&#10;&lt;td&gt;Rate against a rubric of 2 to 10 levels&lt;/td&gt;&#10;&lt;td&gt;Probability-weighted value&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;&lt;a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" target="_blank" rel="noopener"&gt;TypeSafe claims&lt;/a&gt; 70 to 500 ms end to end and $0.042 per million input tokens, with output tokens free.&#10;They also write &amp;ldquo;we can&amp;rsquo;t prove it isn&amp;rsquo;t subsidized.&amp;rdquo;&#10;Either way, it is incredibly cheap and incredibly fast.&lt;/p&gt;&#10;&lt;h2 id="adaptive-participation"&gt;Adaptive participation &lt;a class="anchor" href="#adaptive-participation" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In MindRoom, a conversation can have several humans, several agents, or both.&#10;When I talk to a single agent, it simply replies, and I don&amp;rsquo;t need to tag it.&#10;Once another person joins and writes something, the agent cannot tell whether the message was meant for it or for the other person.&#10;Nothing decided that, so the agent stayed quiet unless explicitly tagged.&#10;That confused several users.&lt;/p&gt;&#10;&lt;p&gt;So I recently added &lt;a href="https://docs.mindroom.chat/configuration/threads/#adaptive-participation" target="_blank" rel="noopener"&gt;adaptive participation&lt;/a&gt;: an agent that has already replied in a thread decides on its own whether to answer an untagged message.&#10;I first used an LLM as the judge, GPT-5.6 Luna on low reasoning.&#10;A yes-or-no question like &amp;ldquo;should this agent respond?&amp;rdquo; is exactly what Jev is for, so it &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2169" target="_blank" rel="noopener"&gt;became the second backend&lt;/a&gt;.&#10;Compared with Luna, it is about ten times cheaper and ten times faster, and if I believe the benchmarks, it is also smarter.&lt;/p&gt;&#10;&lt;h2 id="thanks-should-not-stop-the-agent"&gt;&amp;ldquo;Thanks&amp;rdquo; should not stop the agent &lt;a class="anchor" href="#thanks-should-not-stop-the-agent" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The next thing I used Jev for was interruptions.&#10;When I send a message while an agent is still replying, MindRoom injects a notice at the next tool call telling the agent to stop and wrap up, because there is a new message.&#10;But often I, and other users, would watch the agent start working and then write &amp;ldquo;looks good&amp;rdquo; or &amp;ldquo;thanks.&amp;rdquo;&#10;The agent would stop early and continue in the next turn, which is both wasteful and counterintuitive.&lt;/p&gt;&#10;&lt;p&gt;Now &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2193" target="_blank" rel="noopener"&gt;a judgment&lt;/a&gt; decides whether the new message needs the interruption, which the docs call &lt;a href="https://docs.mindroom.chat/configuration/threads/#mid-turn-coalescing" target="_blank" rel="noopener"&gt;mid-turn coalescing&lt;/a&gt;.&#10;If it does not, the agent reacts with 👀, finishes its reply, and handles the message afterwards.&lt;/p&gt;&#10;&lt;p&gt;This is also where I learned a lesson about evals.&#10;My first implementation worked at the code level but not functionally.&#10;My evals, based on real attempts inside MindRoom that had all failed plus synthetic cases from GPT-6 Astra, passed 5 out of 40 with Jev.&#10;&lt;a href="https://github.com/mindroom-ai/mindroom/pull/2244" target="_blank" rel="noopener"&gt;The fix&lt;/a&gt; changed the question and gave the judge more context, and it went to 40 out of 40.&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;&lt;/th&gt;&#10;&lt;th&gt;Before: 5/40&lt;/th&gt;&#10;&lt;th&gt;After: 40/40&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Question&lt;/td&gt;&#10;&lt;td&gt;&amp;ldquo;May the active task finish before the queued human messages are handled in a later turn?&amp;rdquo;&lt;/td&gt;&#10;&lt;td&gt;&amp;ldquo;Does any newly queued message require an immediate change to, pause of, or stop of the active task?&amp;rdquo;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;When unclear&lt;/td&gt;&#10;&lt;td&gt;&amp;ldquo;Also false when context is incomplete, the relationship is unclear…&amp;rdquo;&lt;/td&gt;&#10;&lt;td&gt;&amp;ldquo;Mere relevance to the task does not make praise or thanks an interruption.&amp;rdquo;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Context&lt;/td&gt;&#10;&lt;td&gt;The request and the new messages&lt;/td&gt;&#10;&lt;td&gt;The same, plus the preceding conversation&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The old question treated anything unclear as a reason to interrupt, and a bare &amp;ldquo;thanks&amp;rdquo; without the conversation around it always looks unclear.&lt;/p&gt;&#10;&lt;h2 id="picking-the-responder"&gt;Picking the responder &lt;a class="anchor" href="#picking-the-responder" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The third decision is routing.&#10;When a message in a room with many agents does not mention anyone, MindRoom&amp;rsquo;s router picks who should answer.&#10;That used to be a free-text LLM prompt, &amp;ldquo;choose the most appropriate agent.&amp;rdquo;&#10;It is &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2238" target="_blank" rel="noopener"&gt;now a Jev Choice&lt;/a&gt; over the eligible agents, plus a &lt;code&gt;no_fit&lt;/code&gt; option, as described in the &lt;a href="https://docs.mindroom.chat/configuration/router/" target="_blank" rel="noopener"&gt;router docs&lt;/a&gt;.&#10;A confident &lt;code&gt;no_fit&lt;/code&gt; asks the user to mention an agent instead of guessing, and anything uncertain falls back to the existing LLM router.&lt;/p&gt;&#10;&lt;h2 id="one-config-line-to-switch"&gt;One config line to switch &lt;a class="anchor" href="#one-config-line-to-switch" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I built a very simple abstraction layer so I can swap Jev for an LLM without changing any code.&#10;Every decision is one question with criteria for true and false:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;MID_TURN_QUESTION&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JudgmentQuestion&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;interrupt_current_turn&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;instructions&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Does any newly queued message require an immediate change to, pause of, or stop of the active task?&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;when_true&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;A new message requests stopping or pausing the active task, corrects it, ...&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;when_false&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;The messages acknowledge progress, express thanks, ask to continue unchanged, ...&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Jev receives it as a Noul question and returns a probability, which MindRoom compares with a threshold.&#10;An LLM receives the same question and context and must return &lt;code&gt;{&amp;quot;decision&amp;quot;: true}&lt;/code&gt; or &lt;code&gt;{&amp;quot;decision&amp;quot;: false}&lt;/code&gt;.&#10;Switching is a configuration change:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;agents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;helper&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;mid_turn&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;defer_reaction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;👀&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;judgment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;typesafe &lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# or: provider: llm, model: fast&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0.8&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Both backends log their decisions and latency, so I can compare them on real traffic.&#10;The code is in &lt;a href="https://github.com/mindroom-ai/mindroom/tree/main/src/mindroom/judgment" target="_blank" rel="noopener"&gt;&lt;code&gt;src/mindroom/judgment/&lt;/code&gt;&lt;/a&gt;, and the backends are documented under &lt;a href="https://docs.mindroom.chat/configuration/threads/#judgment-backends" target="_blank" rel="noopener"&gt;participation judgment backends&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="a-third-backend-openai-decisions"&gt;A third backend: OpenAI Decisions &lt;a class="anchor" href="#a-third-backend-openai-decisions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;On October 7, OpenAI released its own version of the idea, the &lt;a href="https://developers.openai.com/api/docs/guides/decisions" target="_blank" rel="noopener"&gt;Decisions API&lt;/a&gt;, currently in public beta.&#10;The question types match Jev&amp;rsquo;s: a &lt;code&gt;predicate&lt;/code&gt; is a Noul, and &lt;code&gt;choice&lt;/code&gt; and &lt;code&gt;score&lt;/code&gt; keep their names.&#10;It serves a single model, &lt;code&gt;gpt-6-luna&lt;/code&gt;, and OpenAI says it returns answers &amp;ldquo;about 10x faster than the Responses API.&amp;rdquo;&#10;Input costs $0.10 per million tokens and output is free, so it lists at about 2.4 times Jev&amp;rsquo;s price.&lt;/p&gt;&#10;&lt;p&gt;Thanks to the abstraction layer, adding it took &lt;a href="https://github.com/mindroom-ai/mindroom/pull/2751" target="_blank" rel="noopener"&gt;one PR&lt;/a&gt;, merged the same day, and it works for all three decisions, including the router&amp;rsquo;s Choice:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;judgment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;openai_decisions&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;threshold&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0.8&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;From MindRoom&amp;rsquo;s side, only the wire format differs.&#10;The endpoint accepts only user messages, so MindRoom sends each chat message as its own user message, prefixed with its role, like &lt;code&gt;assistant: ...&lt;/code&gt;.&#10;Decisions can also answer with a refusal, which MindRoom treats as an abstention, so the usual fallback applies.&lt;/p&gt;&#10;&lt;p&gt;I tested it against the live API through MindRoom&amp;rsquo;s own code, with the same questions Jev gets.&#10;For participation, it gave 0.99 to replying to a direct question and 0.0 while two humans were talking to each other.&#10;Mid-turn, &amp;ldquo;Thanks, looks great so far!&amp;rdquo; got 0.0 for interrupting and &amp;ldquo;Stop, keep MySQL…&amp;rdquo; got 1.0.&#10;The router sent a pandas bug to &lt;code&gt;code&lt;/code&gt; and a meeting request to &lt;code&gt;calendar&lt;/code&gt;, both with confidence 1.0.&#10;A nonsense request got only 0.62, below the 0.8 threshold, so the normal LLM router took over.&#10;Each call took 130 to 280 ms.&#10;I have not compared it with Jev on real traffic yet, but both log the same outcome fields, so that only takes a config change.&lt;/p&gt;&#10;&lt;h2 id="named-after-jevons"&gt;Named after Jevons &lt;a class="anchor" href="#named-after-jevons" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I only read &lt;a href="https://typesafe.ai/blog/introducing-system-one-models-and-jev" target="_blank" rel="noopener"&gt;why TypeSafe named it Jev&lt;/a&gt; after building all this: they named it after William Stanley Jevons, who noticed that as steam engines burned coal more efficiently, demand for coal went up instead of down.&#10;This is known as the &lt;a href="https://en.wikipedia.org/wiki/Jevons_paradox" target="_blank" rel="noopener"&gt;Jevons paradox&lt;/a&gt;.&#10;That was literally my experience.&#10;Most of what I built was perfectly possible with an LLM.&#10;I just never built it, because I am somewhat cost- and latency-minded.&#10;Once I implemented Jev for one decision, I came up with use case after use case.&lt;/p&gt;&#10;&lt;p&gt;One I already built is a plugin, &lt;a href="https://github.com/mindroom-ai/response-audit-jev-plugin" target="_blank" rel="noopener"&gt;Response Audit JEV&lt;/a&gt;.&#10;Right after an agent replies, Jev checks the answer against the request and the tool calls the agent actually made, for example whether things are properly cited.&#10;If a check flags a problem, the plugin posts one follow-up in the thread that tags the agent and asks for a correction.&#10;Because Jev is so fast and cheap, running this after every reply costs almost nothing.&lt;/p&gt;&#10;&lt;p&gt;Right now I am full of ideas.&#10;For example, a model router.&#10;In MindRoom, an agent can switch to a different model mid-conversation with a tool call, and I can do the same with &lt;code&gt;!model&lt;/code&gt;.&#10;Agents rarely do that without being told, though.&#10;So I default to a very expensive model, and I only save money when I remember to switch to a cheap one for something simple.&#10;Jev could run on every message and decide whether it needs the capable model or not.&#10;That works in both directions, up to a capable model or down to a cheap one.&#10;The perfect moment to switch is when the prompt cache has expired.&#10;A prompt cache belongs to one model, so switching normally means sending the entire context again at full price.&#10;Once the cache has expired, I pay that price anyway, so switching costs nothing extra.&lt;/p&gt;&#10;</description></item><item><title>Frontier-level dictation on your iPhone keyboard, self-hosted</title><link>https://www.nijho.lt/post/diction-agent-cli-qwen/</link><pubDate>Tue, 22 Sep 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/diction-agent-cli-qwen/</guid><description>&lt;p&gt;On a recent month-long trip visiting family in Europe, I did a lot of work from my phone, using &lt;a href="https://www.nijho.lt/post/agentic-mobile-workflow/"&gt;my mobile coding workflow&lt;/a&gt;.&#10;It still boggles my mind that real, productive work from a phone is possible now.&#10;Most of that work is talking to coding agents, and the built-in iOS dictation is garbage for that.&#10;I had an iOS Shortcut that sent recordings to &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;Agent CLI&lt;/a&gt;, &lt;a href="https://www.nijho.lt/post/auto-install-extras/"&gt;my local AI toolbox&lt;/a&gt;, running at home instead.&#10;The problem was that the recording screen takes over the whole display, so I could not see the thing I was commenting on.&#10;The transcript then landed in my clipboard, and I had to paste it myself.&lt;/p&gt;&#10;&lt;p&gt;So I threw my principles overboard and installed &lt;a href="https://wisprflow.ai" target="_blank" rel="noopener"&gt;Wispr Flow&lt;/a&gt;, a voice keyboard for iOS.&#10;I loved it instantly.&#10;iOS does not let keyboards use the microphone, so the keyboard&amp;rsquo;s button hands off to the Wispr Flow app, which keeps recording in the background.&#10;I was less happy about that, since it meant a closed-source app always had the microphone open and sent my voice to their servers.&#10;I was on the free plan, so I was probably the product.&#10;I also hit the free weekly word limit very quickly, and started looking for an alternative.&lt;/p&gt;&#10;&lt;p&gt;That is how I found &lt;a href="https://apps.apple.com/app/id6759807364" target="_blank" rel="noopener"&gt;Diction&lt;/a&gt;, which has since become my favorite app when I&amp;rsquo;m away from my laptop.&#10;It works the same way, background recording included.&#10;The difference is that it has a self-hosted mode with an open-source gateway, so my voice goes to a machine I own instead of their servers.&lt;/p&gt;&#10;&lt;p&gt;I run the &lt;a href="https://github.com/DictionLabs/Diction" target="_blank" rel="noopener"&gt;gateway&lt;/a&gt; on my home machine in the U.S., reachable only over my private network.&#10;The gateway streams audio to Agent CLI, which runs Alibaba&amp;rsquo;s &lt;a href="https://huggingface.co/Qwen/Qwen3-ASR-1.7B-hf" target="_blank" rel="noopener"&gt;&lt;code&gt;Qwen/Qwen3-ASR-1.7B-hf&lt;/code&gt;&lt;/a&gt; on an RTX 3090 behind an OpenAI-compatible transcription endpoint.&#10;There is no LLM cleanup step, so Diction&amp;rsquo;s Writing Style and Tones features do not work with this setup.&#10;I don&amp;rsquo;t miss them: Qwen&amp;rsquo;s raw transcription is already good enough for me.&lt;/p&gt;&#10;&lt;h2 id="1-why-qwen"&gt;1. Why Qwen? &lt;a class="anchor" href="#1-why-qwen" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For the longest time I used &lt;a href="https://github.com/SYSTRAN/faster-whisper" target="_blank" rel="noopener"&gt;Faster-Whisper&lt;/a&gt; with Whisper large-v3.&#10;Whisper is still the default choice for most people, but many newer models beat it.&#10;I tried some of them, including NVIDIA&amp;rsquo;s &lt;a href="https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3" target="_blank" rel="noopener"&gt;Parakeet&lt;/a&gt;.&#10;Parakeet is fast, but it cannot take custom instructions.&#10;Those instructions are how Diction&amp;rsquo;s &lt;strong&gt;My Words&lt;/strong&gt; feature biases a transcription toward specialized names.&lt;/p&gt;&#10;&lt;p&gt;At the start of September, I looked at the &lt;a href="https://huggingface.co/spaces/hf-audio/open_asr_leaderboard" target="_blank" rel="noopener"&gt;Hugging Face Open ASR Leaderboard&lt;/a&gt;, which tests speech-to-text models on the same recordings and ranks them.&#10;The score is the word error rate (WER): the share of words a model gets wrong, counting words it swaps, drops, or makes up.&#10;Lower is better, and a WER of 4% means about one wrong word in every 25.&#10;The test recordings range from audiobooks and podcasts to meetings and earnings calls, so the average says more than any single clean benchmark.&lt;/p&gt;&#10;&lt;p&gt;These are the averages on the public English test sets as of September 19, 2026:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Model&lt;/th&gt;&#10;&lt;th&gt;WER&lt;/th&gt;&#10;&lt;th&gt;Can I run it at home?&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Zoom Scribe v2 Pro&lt;/td&gt;&#10;&lt;td&gt;3.6%&lt;/td&gt;&#10;&lt;td&gt;No, paid API (#1 overall)&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;ElevenLabs Scribe v2&lt;/td&gt;&#10;&lt;td&gt;4.0%&lt;/td&gt;&#10;&lt;td&gt;No, paid API&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Qwen3-ASR 1.7B&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;strong&gt;4.3%&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;strong&gt;Yes, Apache-2.0&lt;/strong&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;AssemblyAI Universal-3.5 Pro&lt;/td&gt;&#10;&lt;td&gt;4.3%&lt;/td&gt;&#10;&lt;td&gt;No, paid API&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;NVIDIA Parakeet TDT 0.6B v3&lt;/td&gt;&#10;&lt;td&gt;4.9%&lt;/td&gt;&#10;&lt;td&gt;Yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;OpenAI Whisper large-v3&lt;/td&gt;&#10;&lt;td&gt;5.8%&lt;/td&gt;&#10;&lt;td&gt;Yes&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;I picked the best model on the board whose weights you can download: Qwen3-ASR 1.7B.&#10;It lands within a point of the best paid API, which is what I mean by frontier-level.&#10;Since I maintain Agent CLI, I told an agent to add a Qwen backend, and shortly afterward &lt;a href="https://github.com/basnijholt/agent-cli/pull/636" target="_blank" rel="noopener"&gt;it had landed&lt;/a&gt; and was running on my server.&lt;/p&gt;&#10;&lt;p&gt;Agent CLI&amp;rsquo;s transcription server loads a model on the first request and unloads it after an idle timeout, so the model only takes VRAM while I use it.&#10;The same process serves an OpenAI-compatible API, which the Diction gateway talks to, and the &lt;a href="https://www.home-assistant.io/integrations/wyoming/" target="_blank" rel="noopener"&gt;Wyoming protocol&lt;/a&gt; that Home Assistant uses for local voice.&lt;/p&gt;&#10;&lt;h2 id="2-the-recipe"&gt;2. The recipe &lt;a class="anchor" href="#2-the-recipe" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You need an NVIDIA GPU with the &lt;a href="https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html" target="_blank" rel="noopener"&gt;NVIDIA Container Toolkit&lt;/a&gt;, Docker Compose 2.30 or newer, and a private route from your iPhone to the server.&#10;I use Headscale, but Tailscale or plain WireGuard works just as well.&#10;Do not expose the gateway to the public internet.&lt;/p&gt;&#10;&lt;h3 id="write-the-compose-file"&gt;Write the Compose file &lt;a class="anchor" href="#write-the-compose-file" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Save the following as &lt;code&gt;compose.yaml&lt;/code&gt; in an empty directory.&#10;Agent CLI&amp;rsquo;s CI publishes a CUDA image with the Transformers backend and Qwen as the default model, so there is nothing to build.&#10;The file points Diction&amp;rsquo;s gateway at Agent CLI&amp;rsquo;s transcription port.&#10;&lt;code&gt;WHISPER_TTL&lt;/code&gt; raises the idle timeout from the default five minutes to a day, so dictation rarely waits for a reload:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;asr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ghcr.io/basnijholt/agent-cli-whisper:0.112.0-cuda-transformers&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;WHISPER_TTL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;86400&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;model-cache:/home/whisper/.cache&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;gpus&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;all&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;restart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;unless-stopped&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;gateway&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;dictionlabs/gateway:v14.0&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;asr&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;CUSTOM_BACKEND_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;http://asr:10301&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;CUSTOM_BACKEND_MODEL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Qwen/Qwen3-ASR-1.7B-hf&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;CUSTOM_BACKEND_CANONICAL_ID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Qwen/Qwen3-ASR-1.7B-hf&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;CUSTOM_BACKEND_NEEDS_WAV&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;true&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="s2"&gt;&amp;#34;8080:8080&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;restart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;unless-stopped&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;model-cache&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="start-it-and-connect-the-app"&gt;Start it and connect the app &lt;a class="anchor" href="#start-it-and-connect-the-app" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Start both services:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;docker compose up -d&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The first transcription downloads Qwen into the &lt;code&gt;model-cache&lt;/code&gt; volume, so that request can take a few minutes.&#10;&lt;code&gt;docker compose logs -f&lt;/code&gt; shows the progress.&lt;/p&gt;&#10;&lt;p&gt;On the iPhone, go to &lt;strong&gt;Settings → General → Keyboard → Keyboards → Add New Keyboard → Diction&lt;/strong&gt;.&#10;Tap Diction in the keyboard list, enable &lt;strong&gt;Allow Full Access&lt;/strong&gt;, and grant microphone access when prompted.&#10;Then open Diction, go to &lt;strong&gt;Preferences → Mode → Self-Hosted&lt;/strong&gt;, enter &lt;code&gt;http://&amp;lt;private-server-ip&amp;gt;:8080&lt;/code&gt;, and tap &lt;strong&gt;Test connection&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;A small upstream detour:&lt;/strong&gt; Diction&amp;rsquo;s &lt;strong&gt;My Words&lt;/strong&gt; feature was not reaching the ASR backend during streaming, so I opened &lt;a href="https://github.com/DictionLabs/Diction/pull/20" target="_blank" rel="noopener"&gt;Diction PR #20&lt;/a&gt; to forward those words as the transcription prompt.&#10;With the fix, package names such as &lt;code&gt;PipeFunc&lt;/code&gt; and &lt;code&gt;MindRoom&lt;/code&gt; come back with the correct spelling and capitalization.&#10;It shipped in gateway v13.0, which is why the Compose file needs at least that version.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;On my machine, Qwen3-ASR 1.7B uses about 4.7 GiB of GPU memory and roughly 3 GiB of system memory while loaded.&lt;/p&gt;&#10;&lt;h2 id="3-the-bar-test"&gt;3. The bar test &lt;a class="anchor" href="#3-the-bar-test" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A day later, I met a friend in a bar in the Netherlands and wanted to let him try it.&lt;/p&gt;&#10;&lt;p&gt;He was already on my tailnet for some of my other self-hosted services, so his phone only needed an ACL change to reach the gateway.&#10;I opened the terminal app on my phone, connected to an agent, and dictated that change.&#10;In less than a minute, Diction was connected and working on his phone.&#10;His speech crossed the Atlantic, was transcribed by Qwen on my home GPU, and appeared back in the app with barely any delay.&lt;/p&gt;&#10;&lt;p&gt;That moment sold the whole setup to me.&#10;I was in a bar without a laptop, and I used dictation to grant access to the dictation service.&lt;/p&gt;&#10;</description></item><item><title>Removing the guardrails and letting my coding agents loose</title><link>https://www.nijho.lt/post/removing-guardrails/</link><pubDate>Tue, 22 Sep 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/removing-guardrails/</guid><description>&lt;p&gt;I have run coding agents in YOLO mode since I started using them in May 2025.&#10;I think it is the only way to parallelize work.&#10;Sometimes I have ten agents running at the same time, and clicking &amp;ldquo;approve&amp;rdquo; on every command they run would make that impossible.&lt;/p&gt;&#10;&lt;p&gt;What makes me comfortable with it is that models tend to do what you ask, and that you can keep them in an environment where they cannot do much harm.&#10;I don&amp;rsquo;t keep secrets within their reach, and above all I have &lt;a href="https://www.nijho.lt/post/btrfs-to-zfs/"&gt;very good backups&lt;/a&gt;.&#10;The last piece is a small set of hooks that block the few things I never want an agent to do on its own.&lt;/p&gt;&#10;&lt;h2 id="why-hooks-and-not-agentsmd"&gt;Why hooks and not AGENTS.md &lt;a class="anchor" href="#why-hooks-and-not-agentsmd" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My system prompt has always told agents not to force-push or merge PRs.&#10;Some of them did it anyway.&lt;/p&gt;&#10;&lt;p&gt;The first time I really noticed was with &lt;a href="https://www.nijho.lt/post/gemini-3-pro-first-impressions/"&gt;Gemini 3 Pro in November 2025&lt;/a&gt;, which merged my PR and force-pushed to &lt;code&gt;main&lt;/code&gt;.&#10;It happened a couple more times in the weeks after, as I parallelized more and asked more of the models.&#10;Three weeks later I had hooks for Claude Code and Gemini CLI that block these commands before they run.&#10;Codex did not support hooks yet.&#10;To my surprise, it did not need them: OpenAI&amp;rsquo;s models are extremely good at following instructions, and Codex never ignored an explicit rule in my &lt;code&gt;AGENTS.md&lt;/code&gt;.&#10;Codex supports hooks by now, so it runs the same ones as the others.&lt;/p&gt;&#10;&lt;p&gt;Claude has been worse at following rules, and Gemini far worse still: absolutely dogshit.&#10;I only try Gemini now and then, and I have been disappointed every time.&#10;By now I don&amp;rsquo;t even try the latest Google models anymore.&lt;/p&gt;&#10;&lt;p&gt;I don&amp;rsquo;t think agents are ever purposely malicious.&#10;They try to do what you asked, but they can misinterpret it, and then they force-push or merge something.&#10;A rule in a Markdown file is a hope; a hook actually stops the command.&#10;Not that a hook would stop a malicious agent: it could put the blocked command in a Bash script and run that instead.&#10;What the hook does is tell the agent why I don&amp;rsquo;t want it, because every block comes with a short explanation:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add -A is not allowed - add files explicitly to avoid adding unrelated untracked files&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The models are well aligned, so once they know my intention, they respect it.&lt;/p&gt;&#10;&lt;h2 id="what-i-block"&gt;What I block &lt;a class="anchor" href="#what-i-block" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All hooks live in &lt;a href="https://github.com/basnijholt/dotfiles/tree/main/configs/claude/hooks" target="_blank" rel="noopener"&gt;my dotfiles&lt;/a&gt;, and I deliberately kept them simple.&#10;The detection logic is one Python module, &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/configs/claude/hooks/git_guard.py" target="_blank" rel="noopener"&gt;&lt;code&gt;git_guard.py&lt;/code&gt;&lt;/a&gt;, and the Claude Code, Codex, and Gemini CLI hooks all import it.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;git commit --amend&lt;/code&gt; and &lt;code&gt;git push --force&lt;/code&gt;.&lt;/strong&gt;&#10;The unit I review is a PR.&#10;When I review a PR, I know I have reviewed it up to a certain commit, and later I only look at the diff of the new commits.&#10;Rewriting history breaks that.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Pushing to &lt;code&gt;main&lt;/code&gt;.&lt;/strong&gt;&#10;Everything happens in PRs.&#10;Inside a PR I don&amp;rsquo;t care how messy the history gets.&#10;I want the agent to push very often, so no work gets lost, and every commit has to be green, so each one is a snapshot I can go back to.&#10;The agent maintains its own development of the feature, and I have not written a commit message myself in a long time.&#10;When the PR is done, I squash merge it.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;gh pr merge&lt;/code&gt;.&lt;/strong&gt;&#10;The merge comes after my review, so it is mine to do.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;git add -A&lt;/code&gt;.&lt;/strong&gt;&#10;I often have unrelated untracked or unstaged files lying around.&#10;I work in many open source repositories, and some of those files should not be public, like deployment plans.&#10;This is the only block without an override.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;code&gt;sleep&lt;/code&gt;.&lt;/strong&gt;&#10;This one is for Claude, and Opus 5 specifically, which I hate with a passion.&#10;It would run tests in the background and then &lt;code&gt;sleep 300&lt;/code&gt;, badly overestimating how long the tests take, when a blocking tool call returns exactly when they finish.&lt;/p&gt;&#10;&lt;h2 id="the-override"&gt;The override &lt;a class="anchor" href="#the-override" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Over time the models got more capable.&#10;I could parallelize more, and I trusted them to work on their own for longer.&#10;I noticed I was spending a significant fraction of my time clicking buttons and doing operations I had forbidden the agent to do, only to end up doing them myself.&lt;/p&gt;&#10;&lt;p&gt;So in July I added an override.&#10;When a hook blocks a command, the agent gets this hint:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;If (and only if) the user has explicitly approved this exact action,&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;re-run the command prefixed with EXPLICITLY_USER_APPROVED_HOOK_OVERRIDE=1 to override this block.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Nothing checks whether I actually approved it.&#10;It is a soft gate, but it works because the agent now has to write down, in the command itself, that I approved the action.&#10;When it runs into the block without my approval, it becomes obvious to the agent that it has to ask me first.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;git add -A&lt;/code&gt; stays hard-blocked, and a chained command cannot carry an override past it: &lt;code&gt;EXPLICITLY_USER_APPROVED_HOOK_OVERRIDE=1 git commit --amend &amp;amp;&amp;amp; git add -A&lt;/code&gt; is still rejected.&lt;/p&gt;&#10;&lt;h2 id="when-the-override-was-used-without-approval"&gt;When the override was used without approval &lt;a class="anchor" href="#when-the-override-was-used-without-approval" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;It has happened, mostly with GPT-5.6 Sol, which I used a lot at the time.&lt;/p&gt;&#10;&lt;p&gt;It used to be that you had to keep your context window short, because auto-compaction was lossy and produced poor summaries.&#10;Since around GPT-5.3, compaction works well enough that I keep a session going for as long as I am working on the same feature.&#10;So I would ask the agent to merge a PR early on, start a follow-up PR in the same session, and after a compaction the agent concluded that it should merge the new PR too.&#10;It did, without my approval.&lt;/p&gt;&#10;&lt;p&gt;The other case was my &lt;a href="https://github.com/mindroom-ai/mindroom/blob/main/.claude/skills/pr-review/SKILL.md" target="_blank" rel="noopener"&gt;&lt;code&gt;pr-review&lt;/code&gt; skill&lt;/a&gt;, by far my favorite skill that I wrote myself.&#10;I would tell the agent to run it and squash merge the PR only if the review approved it.&#10;A few times, the review found problems, the agent fixed them, and then it merged.&#10;What I meant was: merge if it is approved right away, and otherwise wait for me.&#10;Now I spell that out and end with &amp;ldquo;otherwise, wait for my instructions.&amp;rdquo;&lt;/p&gt;&#10;&lt;h2 id="working-from-my-phone"&gt;Working from my phone &lt;a class="anchor" href="#working-from-my-phone" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The override matters most when I am away from my computer.&#10;On a month-long trip visiting family in Europe, I worked only from my phone, using &lt;a href="https://www.nijho.lt/post/agentic-mobile-workflow/"&gt;my mobile coding workflow&lt;/a&gt;.&#10;Typing commands in a terminal on a phone is inconvenient, so I would rather say what I want and let the agent do it, including the merge.&#10;I have also built end-to-end encrypted voice calls to my agents over Matrix with &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom&lt;/a&gt;, and I am moving more toward that kind of voice-driven workflow.&lt;/p&gt;&#10;&lt;h2 id="not-much-has-changed"&gt;Not much has changed &lt;a class="anchor" href="#not-much-has-changed" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I recently reread &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;my first post on agentic coding&lt;/a&gt; from August 2025, and very little in it is outdated.&#10;The models are more capable, and I give them much larger scopes, but the way I work is mostly the same.&#10;The hooks are the main thing I added, and the override is how I loosened them again.&lt;/p&gt;&#10;</description></item><item><title>The last btrfs machine: migrating my PC to ZFS</title><link>https://www.nijho.lt/post/btrfs-to-zfs/</link><pubDate>Thu, 23 Jul 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/btrfs-to-zfs/</guid><description>&lt;p&gt;My GPU machine was the last machine in my fleet still running btrfs.&#10;I &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;bought it for gaming&lt;/a&gt; (which never happened), and these days its dual RTX 3090s almost exclusively run &lt;a href="https://www.nijho.lt/post/llama-nixos/"&gt;local AI models&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;btrfs itself never failed me.&#10;When I set up NixOS on this machine for the first time, I had read enough forum threads to become convinced that ZFS and NixOS were a troublesome combination, so I picked btrfs to be safe.&#10;That belief was simply wrong.&#10;As I &lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;went full Nix&lt;/a&gt; and eventually &lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;moved even my TrueNAS to NixOS&lt;/a&gt;, I learned there was no issue at all.&#10;I just had to figure out the right incantation to make ZFS work with boot drives, &lt;a href="https://github.com/nix-community/disko" target="_blank" rel="noopener"&gt;disko&lt;/a&gt;, and &lt;a href="https://github.com/nix-community/nixos-anywhere" target="_blank" rel="noopener"&gt;nixos-anywhere&lt;/a&gt;.&#10;My HP got ZFS first, that config grew into a shared disko module, and soon the whole fleet ran one pattern: NixOS on ZFS, snapshots and replication declared in code, and backups I can reason about.&lt;/p&gt;&#10;&lt;p&gt;Only the machine I sit at every day kept running on my old misconception, because a daily driver is exactly the one you do not casually reinstall.&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#why-touch-a-working-machine"&gt;Why touch a working machine&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-backup-that-wasnt"&gt;The backup that wasn&amp;rsquo;t&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-the-audit-found"&gt;What the audit found&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-plan-one-shared-disko-module"&gt;The plan: one shared disko module&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#rehearsing-in-a-vm-again"&gt;Rehearsing in a VM, again&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-recovery-kit"&gt;The recovery kit&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#trusting-the-backup-enough-to-wipe-the-disk"&gt;Trusting the backup enough to wipe the disk&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-fifth-question"&gt;The fifth question&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#restoring-in-stages"&gt;Restoring in stages&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#slimming-down-first"&gt;Slimming down first&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-cutover"&gt;The cutover&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#references"&gt;References&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="why-touch-a-working-machine"&gt;Why touch a working machine &lt;a class="anchor" href="#why-touch-a-working-machine" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The operating system was already uniform.&#10;The filesystem was not, and that turned out to matter more than I expected.&lt;/p&gt;&#10;&lt;p&gt;The real trigger was that I got increasingly paranoid about an AI agent messing up my system.&#10;I run agentic AI in YOLO mode, exclusively.&#10;All day, every day, agents execute commands on this machine without asking me first.&#10;YOLO does not mean root, though: the agents run as my regular user, and the backup credentials live where only root can read them.&#10;An agent that could destroy the backup itself would make everything else in this post pointless.&#10;Meanwhile the stories keep coming in about even the most frontier models wiping someone&amp;rsquo;s home directory:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;GPT-5.6-Sol just accidentally deleted almost ALL of my Mac&amp;rsquo;s files. And this is why I trust Fable 1000x more.&lt;/p&gt;&#10;&lt;p&gt;— &lt;a href="https://x.com/mattshumer_/status/2075657271401390161" target="_blank" rel="noopener"&gt;@mattshumer_&lt;/a&gt;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;The reaction is always about which model deserves more trust.&#10;I read these tweets differently.&#10;Give any agent enough sessions and it will eventually delete something important, the same way I do every few years with a tired &lt;code&gt;rm -rf&lt;/code&gt;.&#10;Whether that moment becomes a catastrophe or an inconvenience depends entirely on the restore path.&lt;/p&gt;&#10;&lt;p&gt;So I felt I needed to properly audit the way my backups were done.&#10;I want to be able to answer four questions about any machine I own:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;What exactly is in the backup?&lt;/li&gt;&#10;&lt;li&gt;What is &lt;em&gt;not&lt;/em&gt; in the backup, and did I choose that deliberately?&lt;/li&gt;&#10;&lt;li&gt;How big is a restore?&lt;/li&gt;&#10;&lt;li&gt;How long will it take?&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-backup-that-wasnt"&gt;The backup that wasn&amp;rsquo;t &lt;a class="anchor" href="#the-backup-that-wasnt" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Asking &lt;span class="hover-tip" data-tooltip="What exactly is in the backup?" tabindex="0"&gt;question 1&lt;/span&gt; delivered an unpleasant answer within the hour: the backups had quietly stopped four months earlier.&#10;Two boring causes had stacked up: an interrupted prune left a stale repository lock, which the job could never clear because its own unlock step only ran &lt;em&gt;after&lt;/em&gt; a successful backup, and the repository URL still pointed at &lt;code&gt;truenas.local&lt;/code&gt;, a name that had stopped resolving &lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;along the way&lt;/a&gt;.&#10;The last successful backup ran at 07:00 on March 22; the next one at 07:16 on July 22, after &lt;a href="https://github.com/basnijholt/dotfiles/commit/4d2a75efcb503b9ca2aabcbe8339be3e5a62d0ce" target="_blank" rel="noopener"&gt;the fix&lt;/a&gt;.&#10;Four months, almost to the minute.&#10;systemd logged the failure on every single run, nobody read it, and nothing escalated.&#10;I found out because I asked the question, not because anything told me.&lt;/p&gt;&#10;&lt;h2 id="what-the-audit-found"&gt;What the audit found &lt;a class="anchor" href="#what-the-audit-found" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;On the btrfs box, &lt;span class="hover-tip" data-tooltip="How big is a restore?" tabindex="0"&gt;question 3&lt;/span&gt; alone had three different answers depending on which tool I asked.&#10;&lt;code&gt;du&lt;/code&gt; counted reflinked copies at full size, so directories reported terabytes that physically did not exist.&#10;&lt;code&gt;df&lt;/code&gt; counted physical extents, which is honest about disk usage but tells you nothing about what a file-based restore will write.&#10;And restic reported the &lt;em&gt;apparent&lt;/em&gt; size of sparse VM images, which inflated the restore estimate to several times the disk.&lt;/p&gt;&#10;&lt;p&gt;When your storage layer gives you three sizes for the same data, you do not really understand your backup.&#10;You have a backup, and you have hope.&lt;/p&gt;&#10;&lt;p&gt;&lt;span class="hover-tip" data-tooltip="How long will it take?" tabindex="0"&gt;Question 4&lt;/span&gt; was no better.&#10;Because the PC was my only btrfs machine, it could not join &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/hosts/nas/replication.nix" target="_blank" rel="noopener"&gt;the ZFS snapshot replication the rest of the fleet uses&lt;/a&gt;, so its backups relied entirely on restic pushing to the NAS.&#10;Off-machine, note, but not off-site; &lt;span class="hover-tip" data-tooltip="What is not in the backup, and did I choose that deliberately?" tabindex="0"&gt;question 2&lt;/span&gt; turned out to apply to locations too, and closing that gap is its own project.&#10;restic is file-based: every run visits the metadata of every single file to find what changed.&#10;On this machine that meant close to a hundred million files per scan, which turned out to include some 600 GB of git worktrees stuffed with virtual environments and &lt;code&gt;node_modules&lt;/code&gt;.&#10;Each run took about an hour and a half, even when almost nothing had changed.&lt;/p&gt;&#10;&lt;p&gt;That scan time dictated my backup cadence.&#10;The timer ran hourly, which in practice meant back-to-back scanning all day to move a couple hundred megabytes of real changes, and I recently &lt;a href="https://github.com/basnijholt/dotfiles/commit/4f2401de725d5201d4daca0e67505ad2e6f6691a" target="_blank" rel="noopener"&gt;dropped it to every six hours&lt;/a&gt; to stop the madness.&#10;Either way, my most recent work existed only on the machine an agent was busy poking at.&lt;/p&gt;&#10;&lt;p&gt;The scanning is also not free for the hardware.&#10;Reads are gentle on an SSD compared to writes, but hourly scans of an hour and a half each kept the drive at full duty cycle and elevated temperature for most of every day.&#10;And drives stopped being cheap: I paid $227 for &lt;a href="https://www.nijho.lt/post/homelab/"&gt;a 4 TB NVMe drive&lt;/a&gt; in 2024, and the same drive lists for around $800 today.&#10;I would rather not run the experiment of what years of continuous scanning do to a drive I can no longer afford to replace.&lt;/p&gt;&#10;&lt;p&gt;btrfs has perfectly good snapshots of its own, but sending them off-site was never an option for me: snapshot replication needs the same filesystem on the receiving end, and my NAS speaks ZFS.&#10;With ZFS I can snapshot every few minutes and &lt;code&gt;zfs send&lt;/code&gt; the actual block storage: an incremental send streams exactly the blocks that changed since the last snapshot, without walking a single file.&#10;A hundred million files cost nothing when nobody has to visit them.&lt;/p&gt;&#10;&lt;p&gt;ZFS does not magically collapse those numbers into one.&#10;But it gives me the same semantics everywhere, including on the NAS pools that hold the backups themselves.&#10;Eight of my machines already share a single ZFS disk layout, defined in &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/common/disko-zfs.nix" target="_blank" rel="noopener"&gt;one shared disko module&lt;/a&gt;.&#10;The PC was the odd one out.&#10;This migration makes it nine machines with the exact same strategy, and one backup story to audit instead of one per machine.&lt;/p&gt;&#10;&lt;h2 id="the-plan-one-shared-disko-module"&gt;The plan: one shared disko module &lt;a class="anchor" href="#the-plan-one-shared-disko-module" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The Nix side was the easy part.&#10;The PC now imports the same shared disko module as the other eight machines, with one addition: a &lt;code&gt;swapSize&lt;/code&gt; parameter, because ZFS has no reliable swapfile story and the PC actually needs its 96 GB of swap.&lt;/p&gt;&#10;&lt;p&gt;The disk is &lt;a href="https://github.com/basnijholt/dotfiles/blob/8c0bc5faded40362ac01347682aaf2089562047d/configs/nixos/hosts/pc/disko.nix" target="_blank" rel="noopener"&gt;pinned by ID&lt;/a&gt;, not by device name:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;device&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/dev/disk/by-id/nvme-Samsung_SSD_990_EVO_Plus_4TB_...&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This matters more than usual here.&#10;The PC dual-boots Windows from a second NVMe drive, and I want zero ambiguity about which of the two disks disko is allowed to erase.&lt;/p&gt;&#10;&lt;p&gt;The scary property of this migration is different from the NAS one.&#10;For the NAS, the whole point was that disko must &lt;em&gt;not&lt;/em&gt; touch the data pools.&#10;For the PC, the new ZFS pool goes on the &lt;strong&gt;same disk the data currently lives on&lt;/strong&gt;.&#10;No second disk, no local rollback, no btrfs to boot back into.&#10;From the moment disko runs, the restic repository on the NAS is the only road back.&lt;/p&gt;&#10;&lt;p&gt;That sentence is the reason most of this post is about verification.&lt;/p&gt;&#10;&lt;p&gt;The road back also has to survive the same agents that motivated all of this.&#10;The PC pushes its backups over sftp as a user that owns every file in the repository, which means a compromised PC could delete or encrypt its own safety net.&#10;So the NAS &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/hosts/nas/storage.nix#L128-L143" target="_blank" rel="noopener"&gt;snapshots the repository dataset on its own side&lt;/a&gt;, where the PC&amp;rsquo;s credentials cannot reach: two days of hourly ZFS snapshots and two weeks of dailies that only root on the NAS can destroy.&lt;/p&gt;&#10;&lt;h2 id="rehearsing-in-a-vm-again"&gt;Rehearsing in a VM, again &lt;a class="anchor" href="#rehearsing-in-a-vm-again" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;NAS migration&lt;/a&gt; taught me to rehearse the destructive step in a VM, so the flake grew a &lt;a href="https://github.com/basnijholt/dotfiles/blob/8c0bc5faded40362ac01347682aaf2089562047d/configs/nixos/flake.nix#L110" target="_blank" rel="noopener"&gt;&lt;code&gt;pc-vmtest&lt;/code&gt; target&lt;/a&gt; and I ran the whole install through &lt;code&gt;nixos-anywhere --vm-test&lt;/code&gt;.&#10;Disko formatted a virtual disk, created the pool, installed the system, and booted it with swap active.&lt;/p&gt;&#10;&lt;p&gt;Passing that test proves the generated logic.&#10;It does not prove the backup, which is where the real risk lives.&lt;/p&gt;&#10;&lt;h2 id="the-recovery-kit"&gt;The recovery kit &lt;a class="anchor" href="#the-recovery-kit" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A restore that starts with &amp;ldquo;first, log in to the dead machine and fetch the credentials&amp;rdquo; is not a restore plan.&#10;So everything a bare reinstall needs lives in a small recovery kit on two other machines in the house, permissions locked down: the restic password and SSH key that reach the repository, the staged restore script, a couple of verification scripts, and the PC&amp;rsquo;s SSH host keys.&#10;The host keys matter more than they look: the reinstalled machine comes back with its old identity, so no client complains and nothing in the fleet needs to be taught to trust a new machine.&#10;A munge key and a README round it out.&lt;/p&gt;&#10;&lt;h2 id="trusting-the-backup-enough-to-wipe-the-disk"&gt;Trusting the backup enough to wipe the disk &lt;a class="anchor" href="#trusting-the-backup-enough-to-wipe-the-disk" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My recovery story has two layers.&#10;NixOS makes the &lt;em&gt;system&lt;/em&gt; disposable: every service, driver fix, and firewall rule is in git, so no agent can leave the machine in a state I cannot rebuild.&#10;Verified backups make the &lt;em&gt;data&lt;/em&gt; recoverable.&#10;This migration is the voluntary version of the tweets above: I am about to delete all of my PC&amp;rsquo;s files on purpose.&lt;/p&gt;&#10;&lt;p&gt;I did three verifications, each one converting an assumption into a fact.&#10;An AI agent did the tedious sweeps; I reviewed the evidence.&lt;/p&gt;&#10;&lt;p&gt;The first check was completeness.&#10;We walked everything on the machine &lt;em&gt;outside&lt;/em&gt; the backup paths, until every byte was accounted for.&#10;It was all re-downloadable caches, and the largest unexplained thing turned out to be restic&amp;rsquo;s own local cache.&#10;Everything outside the backup set is now &lt;em&gt;known&lt;/em&gt; disposable instead of &lt;em&gt;assumed&lt;/em&gt; disposable.&lt;/p&gt;&#10;&lt;p&gt;The second check was the restore path.&#10;A backup you have never restored from is a hypothesis.&#10;On a different machine, using only the recovery kit and no access to the PC at all, we restored a sample from the latest snapshot and compared hashes against the live system.&#10;The hashes matched byte for byte, and even the symlinks came back pointing at the right targets.&#10;A sample proves the path works, from credentials to symlink handling; reading back every byte is the third check&amp;rsquo;s job.&#10;The machine running the rehearsal had the kit and nothing else, so recovery provably does not depend on the machine being recovered.&lt;/p&gt;&#10;&lt;p&gt;The third check is the data itself.&#10;&lt;code&gt;restic check&lt;/code&gt; validates the repository structure without reading back the actual data blobs.&#10;Before the wipe, a &lt;code&gt;--read-data&lt;/code&gt; pass ran on the NAS, where the repository sits on local disk instead of behind the network.&#10;When the backup is the only rollback, I want its bits read back at least once.&lt;/p&gt;&#10;&lt;h2 id="the-fifth-question"&gt;The fifth question &lt;a class="anchor" href="#the-fifth-question" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The outage taught me a &lt;span class="hover-tip" data-tooltip="How do I find out when any of this stops working?" tabindex="0"&gt;fifth question&lt;/span&gt;: how do I find out when any of this stops working?&#10;All three checks above are point-in-time, and verification rots.&#10;So the NAS now &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/hosts/nas/replication.nix#L263-L285" target="_blank" rel="noopener"&gt;re-verifies every hour&lt;/a&gt;, from its own side of the sftp connection, that the newest snapshot in the repository is less than a day old, and pushes an alert to my phone when it is not.&#10;That catches every failure mode on the PC side, including &amp;ldquo;the timer is simply disabled.&amp;rdquo;&#10;The watcher itself is watched: the NAS pings an &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/hosts/nas/health.nix#L252-L280" target="_blank" rel="noopener"&gt;external dead-man&amp;rsquo;s switch&lt;/a&gt; every five minutes, so if the machine holding my only road back goes dark, the alert comes from outside the house.&lt;/p&gt;&#10;&lt;p&gt;While wiring this up we discovered that months of earlier NAS alerts had never arrived, because &lt;a href="https://github.com/basnijholt/dotfiles/blob/0d6101c8e3f91a0845cb41adb3cda216f50917c8/configs/nixos/hosts/nas/health.nix#L60-L67" target="_blank" rel="noopener"&gt;ntfy silently rejects message bodies over 4 KB&lt;/a&gt;.&#10;A notification you have never received is also a hypothesis.&lt;/p&gt;&#10;&lt;h2 id="restoring-in-stages"&gt;Restoring in stages &lt;a class="anchor" href="#restoring-in-stages" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The measured restore set came out to roughly 1 TB, and 99.9% of it is &lt;code&gt;/home&lt;/code&gt;.&#10;But two directories are 64% of that terabyte: Steam (430 GB of re-downloadable games) and my local-AI model collection (217 GB of GGUF files).&lt;/p&gt;&#10;&lt;p&gt;I do not need either of those to have a working machine.&#10;So the restore script now runs in stages:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ./restore_from_backup.sh stage1 &lt;span class="c1"&gt;# everything else → a fully working machine&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo ./restore_from_backup.sh stage2 &lt;span class="c1"&gt;# Steam + models, whenever&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Stage 1 restores everything except the deferred paths, plus the system identity (host keys).&#10;Stage 2 can run days later, from the rebooted system, while I am already using the machine.&lt;/p&gt;&#10;&lt;p&gt;One detail I care about: stage 1 resolves &lt;code&gt;latest&lt;/code&gt; to a concrete snapshot ID and pins it to a file.&#10;Stage 2 reads the pin.&#10;My backups run every six hours, so without this, a timer firing between the stages would silently split the restore across two different snapshots.&lt;/p&gt;&#10;&lt;p&gt;The backup itself is untouched: Steam and the models are still in every snapshot.&#10;Only the restore order changed.&lt;/p&gt;&#10;&lt;h2 id="slimming-down-first"&gt;Slimming down first &lt;a class="anchor" href="#slimming-down-first" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The PC had also quietly become an Incus host for three LXC containers, including the &lt;a href="https://www.nijho.lt/post/mindroom/"&gt;MindRoom bots&lt;/a&gt; my family talks to every day.&#10;Before the migration, those containers moved to the NAS.&#10;That shrinks both the backup and the restore, and the family bots keep running while their old host is being wiped.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Moving the containers produced its own lesson in btrfs size confusion.&#10;One container that measured &amp;ldquo;about 250 GB&amp;rdquo; shipped over 590 GB across the network overnight, because a directory that every disk-usage probe had failed to measure turned out to hold 2.5 TB of reflink-inflated build dependencies.&#10;The rule I took away: a directory that has &lt;em&gt;never been successfully measured&lt;/em&gt; is a red alert, not a rounding error.&#10;That kind of confusion is part of why this migration exists.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="the-cutover"&gt;The cutover &lt;a class="anchor" href="#the-cutover" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The install followed the same phased &lt;code&gt;nixos-anywhere&lt;/code&gt; pattern as the NAS cutover, driven from another machine on the LAN: kexec into an installer running in RAM, stop, re-verify the target disk from inside the installer, and only then run the destructive disko/install phase.&#10;That checkpoint is the whole point: right up to the destructive phase, aborting was still cheap.&#10;The destructive part turned out to be the trivial part: from wiping the disk to booting the new system took less than twenty minutes.&lt;/p&gt;&#10;&lt;p&gt;The one surprise of the day was in the restore, and it was exactly the kind rehearsal is supposed to catch.&#10;Stage 1 would not start: the restore script runs restic as root, and a freshly installed root has no SSH identity and no known_hosts.&#10;The key it needed sat in the recovery kit inside my home directory.&#10;The rehearsal never hit this, because the rehearsal machine&amp;rsquo;s root had already talked to the NAS.&#10;A verified restore path can still depend on state you forgot you had.&lt;/p&gt;&#10;&lt;p&gt;Stage 1 restored 534 GiB across 4.5 million files in just over an hour and a half, at wire speed.&#10;The machine rebooted with its old host keys and its old &lt;code&gt;/home&lt;/code&gt;, and stage 2 started immediately.&#10;The plan said stage 2 could wait for days; it started the minute the machine was back, because once the machine works there is no reason left to wait.&#10;The deferred 648 GiB of games and models took six more hours in the background.&lt;/p&gt;&#10;&lt;p&gt;With that, the PC finally joins the fleet pattern it was locked out of: sanoid snapshots the pool every hour, so a tired &lt;code&gt;rm -rf&lt;/code&gt;, mine or an agent&amp;rsquo;s, now costs at most an hour of work and a rollback, and a daily syncoid run sends the changed blocks to the NAS.&#10;restic is on borrowed time.&#10;Its six-hour timer keeps running until I trust the new path, and then it stops: the repository stays on the NAS as the last file-level snapshots of the machine, but nothing will be added to it.&lt;/p&gt;&#10;&lt;p&gt;Aftercare was the same short list, written down instead of remembered: revert the temporary root-SSH commit the installer needed, and put the restic password back where the backup service expects it.&lt;/p&gt;&#10;&lt;p&gt;The slow work, as always, was not the cutover.&#10;The slow work was making the cutover boring.&lt;/p&gt;&#10;&lt;h2 id="references"&gt;References &lt;a class="anchor" href="#references" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;I&amp;rsquo;ve gone full Nix: Proxmox to NixOS + Incus&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/truenas-to-nixos/"&gt;Migrating from TrueNAS to NixOS&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/homelab/"&gt;My homelab&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/pull/16" target="_blank" rel="noopener"&gt;The btrfs→ZFS migration PR&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/pull/67" target="_blank" rel="noopener"&gt;The PR that closed the silent backup-monitoring failure modes&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/nix-community/disko" target="_blank" rel="noopener"&gt;disko&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/nix-community/nixos-anywhere" target="_blank" rel="noopener"&gt;nixos-anywhere&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://restic.net/" target="_blank" rel="noopener"&gt;restic&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/jimsalterjrs/sanoid" target="_blank" rel="noopener"&gt;Sanoid&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>Migrating from TrueNAS to NixOS without losing data after the build-system rug pull</title><link>https://www.nijho.lt/post/truenas-to-nixos/</link><pubDate>Sun, 28 Jun 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/truenas-to-nixos/</guid><description>&lt;p&gt;TrueNAS was the last non-NixOS machine in my home lab.&lt;/p&gt;&#10;&lt;p&gt;I kept postponing it for a simpler reason: moving something with ~100 TiB of data feels scary.&#10;My NAS holds the big ZFS pools.&#10;It has the SMB shares, NFS exports, snapshots, replication tasks, encrypted datasets, Incus state, Docker workloads, and all the boring-but-important health checks that are easy to take for granted until something fails.&lt;/p&gt;&#10;&lt;p&gt;I had already migrated most of my machines from Proxmox to NixOS with Incus, as I wrote about in &lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;I&amp;rsquo;ve gone full Nix: Proxmox to NixOS + Incus&lt;/a&gt;.&#10;That migration made me increasingly intolerant of appliance-style infrastructure.&#10;If the important state lives in a database behind a web UI, I cannot review it in a pull request.&#10;If I change something while debugging, I cannot guarantee the change made it back into the source of truth.&#10;And if I let an AI agent help me, imperative systems become even more uncomfortable: an agent can run a hundred commands, succeed, and leave behind a system that nobody can reproduce.&#10;For the NAS specifically, that basically meant I did not dare touch the machine with an AI agent at all.&lt;/p&gt;&#10;&lt;p&gt;NixOS is different.&#10;The diff is the state.&#10;If an agent changes my infrastructure, I can review the patch.&#10;If the change is wrong, I can reject it.&#10;If it works, I can commit it.&lt;/p&gt;&#10;&lt;p&gt;TrueNAS was the last holdout.&#10;It had been itching for a while.&#10;Then the &lt;a href="https://forums.truenas.com/t/clearing-the-air-on-build-scripts/64357" target="_blank" rel="noopener"&gt;build-system rug pull&lt;/a&gt; made the decision easy.&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-itch-before-the-last-straw"&gt;The itch before the last straw&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-last-straw"&gt;The last straw&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-this-was-scarier-than-proxmox"&gt;Why this was scarier than Proxmox&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#giving-an-agent-the-keys-carefully"&gt;Giving an agent the keys, carefully&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-nixos-scaffold"&gt;The NixOS scaffold&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-disko-problem"&gt;The disko problem&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#rehearsing-the-dangerous-part-in-a-vm"&gt;Rehearsing the dangerous part in a VM&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-parts-that-are-not-just-storage"&gt;The parts that are not just storage&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#secrets-stay-out-of-the-repo"&gt;Secrets stay out of the repo&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#where-this-leaves-truenas"&gt;Where this leaves TrueNAS&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-cutover"&gt;The cutover&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#references"&gt;References&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="the-itch-before-the-last-straw"&gt;The itch before the last straw &lt;a class="anchor" href="#the-itch-before-the-last-straw" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The build-system change was not the first thing that bothered me.&#10;It was just the last straw.&lt;/p&gt;&#10;&lt;p&gt;The deeper problem was that my TrueNAS setup had slowly become complicated in exactly the way I dislike.&#10;I had clicked many buttons in the UI over time:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;SMB shares&lt;/li&gt;&#10;&lt;li&gt;NFS exports&lt;/li&gt;&#10;&lt;li&gt;snapshot tasks&lt;/li&gt;&#10;&lt;li&gt;replication tasks&lt;/li&gt;&#10;&lt;li&gt;users and groups&lt;/li&gt;&#10;&lt;li&gt;encrypted datasets&lt;/li&gt;&#10;&lt;li&gt;apps and containers&lt;/li&gt;&#10;&lt;li&gt;Incus storage&lt;/li&gt;&#10;&lt;li&gt;old Jailmaker/systemd-nspawn state&lt;/li&gt;&#10;&lt;li&gt;alerting&lt;/li&gt;&#10;&lt;li&gt;UPS settings&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;TrueNAS can export and import its configuration.&#10;That is genuinely useful.&#10;But a database export is not the same thing as a configuration I can comfortably review.&#10;When I look at a TrueNAS backup, it is not obvious to me which settings I intentionally changed, which settings are defaults, which settings are historical leftovers, and which settings only exist because I clicked something while debugging two years ago.&lt;/p&gt;&#10;&lt;p&gt;One concrete example was NFS.&#10;I needed the &lt;code&gt;crossmnt&lt;/code&gt; export option so child datasets would show up correctly inside the Docker container host, but TrueNAS did not expose that option in the UI.&#10;So I had a periodic root cron job patching &lt;code&gt;/etc/exports&lt;/code&gt; after TrueNAS generated it.&#10;It worked, but it was exactly the kind of small appliance hack that made me uneasy: partly outside the UI, partly outside the exported configuration, and very easy to forget during a migration.&#10;In NixOS, that behavior is just part of the export line.&lt;/p&gt;&#10;&lt;p&gt;That is the exact discomfort that pushed me away from Proxmox.&#10;I do not want to remember what I clicked.&#10;I want the system to remember it as code.&lt;/p&gt;&#10;&lt;p&gt;The second itch was virtualization.&#10;My TrueNAS container story had already gone through one migration.&#10;For a while I used &lt;a href="https://github.com/Jip-Hop/jailmaker" target="_blank" rel="noopener"&gt;Jailmaker&lt;/a&gt;, which is a clever script around &lt;code&gt;systemd-nspawn&lt;/code&gt; for running Linux &amp;ldquo;jails&amp;rdquo; on TrueNAS SCALE.&#10;It worked well enough for what I needed at the time: a Debian environment where I could run Docker workloads close to the data.&#10;But it also reinforced the feeling that I was building a fairly custom server on top of an appliance OS.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.truenas.com/docs/scale/25.04/" target="_blank" rel="noopener"&gt;TrueNAS 25.04 &amp;ldquo;Fangtooth&amp;rdquo;&lt;/a&gt; introduced experimental Containers, named Instances in the early 25.04 releases, and the &lt;a href="https://www.truenas.com/blog/truenas-fangtooth-25-04-1/" target="_blank" rel="noopener"&gt;25.04.1 announcement&lt;/a&gt; explicitly described Instances as being based on Incus, supporting both VMs and LXCs.&#10;That was interesting to me because the older TrueNAS VM system was libvirt-based, while Incus felt like a more coherent container/VM story.&#10;Then the &lt;a href="https://forums.truenas.com/t/truenas-virtualization-plans-for-25-04-2/46236" target="_blank" rel="noopener"&gt;TrueNAS virtualization plan for 25.04.2&lt;/a&gt; explained that Fangtooth&amp;rsquo;s Instances feature caused challenges for some users and that 25.04.2 would re-enable the older Virtualization VM path alongside Instances.&#10;The &lt;a href="https://forums.truenas.com/t/truenas-25-04-2-is-now-available/49165" target="_blank" rel="noopener"&gt;25.04.2 release announcement&lt;/a&gt; made that split official: Virtual Machines came back, while VMs created through the earlier Instances feature continued to appear under Containers.&lt;/p&gt;&#10;&lt;p&gt;For many people that churn was probably annoying.&#10;For me it was especially ironic.&#10;I had migrated from Jailmaker&amp;rsquo;s &lt;code&gt;systemd-nspawn&lt;/code&gt; setup to Incus, read up on &lt;a href="https://linuxcontainers.org/incus/" target="_blank" rel="noopener"&gt;Incus&lt;/a&gt;, got excited about it, started using it, and then became genuinely happy with it when I migrated from Proxmox to NixOS with Incus.&#10;Incus fit my mental model perfectly: a clean CLI, containers and VMs in one place, easy scripting, and a workflow that agents can inspect.&lt;/p&gt;&#10;&lt;p&gt;Then TrueNAS started moving away from that direction again.&#10;Forum discussion around the 25.04.2 and later virtualization plans made it clear that Incus was not the stable long-term abstraction I hoped it would be inside TrueNAS.&#10;In the long-running &lt;a href="https://forums.truenas.com/t/linux-jails-containers-vms-with-incus/23599?page=21" target="_blank" rel="noopener"&gt;Linux Jails with Incus thread&lt;/a&gt;, Kris Moore is quoted saying that Incus is being removed from the base system and that libvirt will handle the backend for VMs and LXC.&#10;That probably makes sense for TrueNAS.&#10;They have enterprise users, compatibility concerns, and a support matrix that is very different from mine.&lt;/p&gt;&#10;&lt;p&gt;But for me it meant the NAS was again becoming an appliance whose internal direction I had to follow.&#10;I had just escaped that with Proxmox.&#10;I did not want to do it again for the most important machine in my house.&lt;/p&gt;&#10;&lt;h2 id="the-last-straw"&gt;The last straw &lt;a class="anchor" href="#the-last-straw" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Then I saw Jeff Geerling mention TrueNAS&amp;rsquo;s recent &amp;ldquo;shady behavior&amp;rdquo; in a video, and I started looking into what had actually changed.&lt;/p&gt;&#10;&lt;p&gt;The short version is that iXsystems made part of the TrueNAS ecosystem closed source.&#10;Specifically, iXsystems moved the TrueNAS build scripts and related build infrastructure internal for the TrueNAS 27 line.&#10;Their forum post, &lt;a href="https://forums.truenas.com/t/clearing-the-air-on-build-scripts/64357" target="_blank" rel="noopener"&gt;Clearing the Air on Build Scripts&lt;/a&gt;, frames this as a practical build-system decision and says normal installation and updates remain unaffected.&#10;The old &lt;a href="https://github.com/truenas/scale-build" target="_blank" rel="noopener"&gt;&lt;code&gt;truenas/scale-build&lt;/code&gt;&lt;/a&gt; repository now says it is preserved historically and is no longer the maintained build system.&#10;Community reactions, for example &lt;a href="https://forums.truenas.com/t/truenas-closing-its-build-system-has-sparked-a-significant-trust-crisis-in-the-self-hosted-and-engineering-communities/64549" target="_blank" rel="noopener"&gt;this TrueNAS forum thread&lt;/a&gt;, understandably read this as a meaningful step away from fully open development.&lt;/p&gt;&#10;&lt;p&gt;Would I ever have built TrueNAS from source myself?&#10;Almost certainly not.&lt;/p&gt;&#10;&lt;p&gt;That misses the point.&#10;I also rarely compile my Linux kernel manually, yet I care deeply that the ecosystem is open enough that I &lt;em&gt;could&lt;/em&gt; understand, rebuild, inspect, and fork the pieces if necessary.&#10;For a storage appliance, trust matters more than convenience.&#10;The NAS is not a toy VM.&#10;It is the machine that owns my data.&lt;/p&gt;&#10;&lt;p&gt;That was the final push.&#10;The UI state bothered me.&#10;The virtualization churn bothered me.&#10;The build-system change made the decision obvious.&lt;/p&gt;&#10;&lt;h2 id="why-this-was-scarier-than-proxmox"&gt;Why this was scarier than Proxmox &lt;a class="anchor" href="#why-this-was-scarier-than-proxmox" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Migrating Proxmox to NixOS was scary in the normal infrastructure sense.&#10;I had containers and VMs to move, but the blast radius was understandable.&#10;I could export with &lt;code&gt;vzdump&lt;/code&gt;, import into Incus, and test a lot of it in virtual machines.&lt;/p&gt;&#10;&lt;p&gt;Migrating TrueNAS is a different kind of scary.&#10;The data is not a VM disk that I can casually copy around.&#10;The important thing is &lt;em&gt;not&lt;/em&gt; to recreate the data pools.&#10;The important thing is to &lt;strong&gt;not touch them&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;The target architecture is simple in principle:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Conceptually:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# - disko owns only the boot disk&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# - existing data pools are imported by name&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;boot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zfs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;extraPools&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;ssd&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;tank&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The NixOS boot disk can be destroyed and recreated.&#10;The existing &lt;code&gt;tank&lt;/code&gt; and &lt;code&gt;ssd&lt;/code&gt; pools cannot.&lt;/p&gt;&#10;&lt;p&gt;This is the part where many migration guides become hand-wavy:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Install the new OS.&lt;/li&gt;&#10;&lt;li&gt;Import your ZFS pools.&lt;/li&gt;&#10;&lt;li&gt;Good luck.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;That is not enough for me.&#10;I could physically access the machine, but unplugging the relevant NVMe hardware would mean taking apart more of the box than I wanted to touch.&#10;So I treated the cutover as if the disks had to stay connected.&#10;And I absolutely did not want one typo in a disk path to become yet another meme in AI agent failures.&lt;/p&gt;&#10;&lt;h2 id="giving-an-agent-the-keys-carefully"&gt;Giving an agent the keys, carefully &lt;a class="anchor" href="#giving-an-agent-the-keys-carefully" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Without AI this would probably have become a week-long project that I would forever postpone.&#10;With AI, it felt plausible to get the first serious version done in a single sitting.&#10;My approach was to give GPT 5.5 in xhigh mode SSH access to the live TrueNAS box and tell it, repeatedly and very explicitly, not to change anything.&#10;To be clear, it had root access.&#10;At this point these models have become powerful enough that I trust them to follow explicit instructions.&#10;The safety boundary was instruction-following, narrow scope, and review.&lt;/p&gt;&#10;&lt;p&gt;Not &amp;ldquo;please be careful.&amp;rdquo;&#10;More like:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;You can inspect.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;You cannot change anything.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Do not start or stop services.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Do not import or export pools.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Do not load keys.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Do not mount datasets.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Read only.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is the part where people either nod along or think I have completely lost my mind.&#10;I think the distinction matters.&#10;I did not ask an agent to &amp;ldquo;migrate my NAS.&amp;rdquo;&#10;I asked it to inspect the current system, summarize the live state, compare that against my NixOS repository, and propose declarative config.&lt;/p&gt;&#10;&lt;p&gt;Then I reviewed the diffs.&#10;Then I asked for another review.&#10;Then another.&#10;The process was messier than one neat two-agent pass: build a scaffold, ask a model to attack it, compare that against the live TrueNAS state, refine the scaffold, and repeat.&#10;GPT 5.5 did most of the initial construction.&#10;Claude Opus 4.8 on max effort did one of the later independent cross-checks against the live system.&#10;By the end, I trusted the result because multiple independent reviews had converged on the same assumptions, and I understood the remaining differences.&#10;The loop felt like code review: inspect live state, turn the desired parts into Nix, review the diff, and ask another model to attack it.&#10;The scariest assumption got a VM test, and the destructive step stayed small.&lt;/p&gt;&#10;&lt;p&gt;Byte-for-byte TrueNAS cloning was never the target.&#10;I wanted every important behavior explicit: storage import, shares, snapshots, replication, Incus recovery, monitoring, and the few places where NixOS intentionally differs from the old appliance.&#10;At that point, the NixOS config reproduced the parts of TrueNAS I actually depended on, and the remaining differences were deliberate.&lt;/p&gt;&#10;&lt;p&gt;The agent was excellent at inventory:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Which pools exist&lt;/li&gt;&#10;&lt;li&gt;Which datasets are encrypted&lt;/li&gt;&#10;&lt;li&gt;Which NFS exports are live&lt;/li&gt;&#10;&lt;li&gt;Which SMB shares exist&lt;/li&gt;&#10;&lt;li&gt;Which users and numeric IDs matter&lt;/li&gt;&#10;&lt;li&gt;What Incus storage pool is in use&lt;/li&gt;&#10;&lt;li&gt;What replication tasks exist&lt;/li&gt;&#10;&lt;li&gt;What SMART/NUT/health monitoring exists&lt;/li&gt;&#10;&lt;li&gt;What host ID ZFS expects&lt;/li&gt;&#10;&lt;li&gt;Which disk is the current boot pool&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Preserving everything blindly would have been wrong.&#10;The useful parts became code, and the dangerous parts became explicit.&lt;/p&gt;&#10;&lt;h2 id="the-nixos-scaffold"&gt;The NixOS scaffold &lt;a class="anchor" href="#the-nixos-scaffold" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The resulting NixOS host is split into small files:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;hosts/nas/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── default.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── disko.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── hardware-configuration.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── health.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── identity.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── networking.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── nfs.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── replication.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── samba.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── storage.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── virtualization.nix&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── CUTOVER.md&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── PLANNING.md&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is exactly why I like NixOS.&#10;The migration stopped being a list of steps I needed to follow and became a &lt;a href="https://github.com/basnijholt/dotfiles/pull/61/" target="_blank" rel="noopener"&gt;pull request&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;The important storage boundary is:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;disko.nix&lt;/code&gt; describes only the boot disk.&lt;/li&gt;&#10;&lt;li&gt;The data pools are imported by name.&lt;/li&gt;&#10;&lt;li&gt;ZFS force-import is disabled.&lt;/li&gt;&#10;&lt;li&gt;Boot-time encrypted credential prompts are disabled.&lt;/li&gt;&#10;&lt;li&gt;Encrypted datasets are unlocked manually after boot.&lt;/li&gt;&#10;&lt;li&gt;Sanoid/Syncoid replace TrueNAS snapshot and replication tasks.&lt;/li&gt;&#10;&lt;li&gt;SMB, NFS, Docker, Incus, SMART, ZED, NUT, Netdata, and exporters are all declared in code.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The data pools are intentionally &lt;em&gt;not&lt;/em&gt; in disko.&#10;That is the entire point.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;The host is called &lt;code&gt;nas&lt;/code&gt; because that is the role I want to keep.&#10;TrueNAS was the old implementation.&#10;NixOS becomes the new one, while preserving the services and data I actually need.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="the-disko-problem"&gt;The disko problem &lt;a class="anchor" href="#the-disko-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/nix-community/disko" target="_blank" rel="noopener"&gt;&lt;code&gt;disko&lt;/code&gt;&lt;/a&gt; is a fantastic tool.&#10;It lets you describe disks declaratively and then formats/partitions/mounts them.&#10;For a fresh NixOS install, it is exactly what I want.&lt;/p&gt;&#10;&lt;p&gt;This also fits how I install NixOS machines.&#10;I build a custom &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/configs/nixos/installers/iso.nix" target="_blank" rel="noopener"&gt;installer ISO&lt;/a&gt;, put it on a USB stick, and boot from it.&#10;The image already has SSH enabled with my keys, flakes enabled, and the tooling needed to run the repo-defined &lt;code&gt;disko&lt;/code&gt; and &lt;code&gt;nixos-install&lt;/code&gt; flow.&#10;That turns the installer environment into part of the reviewed configuration, instead of another place where I have to remember which choices to make.&lt;/p&gt;&#10;&lt;p&gt;It is also exactly the tool that can ruin your day if pointed at the wrong disk.&lt;/p&gt;&#10;&lt;p&gt;My requirement was:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;Use disko to destroy and recreate the boot disk, but prove it cannot touch the existing ZFS data pools.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;The static config already looked right.&#10;The generated disko script only referenced the boot device and generated partition labels.&#10;The data pools were only present under &lt;code&gt;boot.zfs.extraPools&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;But &amp;ldquo;looks right&amp;rdquo; is not enough when the downside is wiping a NAS.&lt;/p&gt;&#10;&lt;p&gt;So we built a VM rehearsal.&lt;/p&gt;&#10;&lt;h2 id="rehearsing-the-dangerous-part-in-a-vm"&gt;Rehearsing the dangerous part in a VM &lt;a class="anchor" href="#rehearsing-the-dangerous-part-in-a-vm" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The VM test creates a miniature version of the dangerous situation:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Attach several throwaway disks to a disposable NixOS VM.&lt;/li&gt;&#10;&lt;li&gt;Create a fake &lt;code&gt;boot-pool&lt;/code&gt; on one disk.&lt;/li&gt;&#10;&lt;li&gt;Create fake &lt;code&gt;tank&lt;/code&gt; and &lt;code&gt;ssd&lt;/code&gt; ZFS pools on other disks.&lt;/li&gt;&#10;&lt;li&gt;Write sentinel files into the fake data pools.&lt;/li&gt;&#10;&lt;li&gt;Export the fake data pools.&lt;/li&gt;&#10;&lt;li&gt;Run the generated &lt;code&gt;nas&lt;/code&gt; disko script against the fake boot disk.&lt;/li&gt;&#10;&lt;li&gt;Confirm the boot disk now contains the new &lt;code&gt;zroot&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Confirm fake &lt;code&gt;tank&lt;/code&gt; and &lt;code&gt;ssd&lt;/code&gt; still have their ZFS labels.&lt;/li&gt;&#10;&lt;li&gt;Re-import fake &lt;code&gt;tank&lt;/code&gt; and &lt;code&gt;ssd&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Read the sentinel files.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The check lives in the flake now:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; configs/nixos&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nix build .#checks.x86_64-linux.nas-disko-safety&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It passed.&lt;/p&gt;&#10;&lt;p&gt;Passing that VM test gives me confidence in the generated Nix/disko logic.&#10;The read-only check on the live TrueNAS box gives me confidence in the configured disk target: the by-id path resolves to the 500 GB &lt;code&gt;boot-pool&lt;/code&gt; disk, and &lt;code&gt;tank&lt;/code&gt; and &lt;code&gt;ssd&lt;/code&gt; live on different devices.&#10;The installer preflight repeats that same check immediately before the destructive step.&lt;/p&gt;&#10;&lt;p&gt;This is the level of paranoia I want around storage migrations.&lt;/p&gt;&#10;&lt;h2 id="the-parts-that-are-not-just-storage"&gt;The parts that are not just storage &lt;a class="anchor" href="#the-parts-that-are-not-just-storage" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Once the &amp;ldquo;do not wipe the pools&amp;rdquo; boundary was in place, the rest of the migration became more normal infrastructure work.&#10;Still annoying, but normal.&lt;/p&gt;&#10;&lt;p&gt;SMB was not a byte-for-byte port.&#10;TrueNAS ships private Samba VFS modules and has its own ACL/middleware behavior.&#10;Stock NixOS Samba covers the parts I need with &lt;code&gt;fruit&lt;/code&gt;, &lt;code&gt;streams_xattr&lt;/code&gt;, and sensible share definitions, but it is not literally the same stack.&#10;So the plan calls out what must be tested from real clients: Time Machine, guest access, and photo/media access.&lt;/p&gt;&#10;&lt;p&gt;Snapshots and replication also changed.&#10;TrueNAS snapshot tasks become Sanoid policy.&#10;TrueNAS replication tasks become Syncoid systemd timers.&#10;Existing snapshots are preserved, but Sanoid will not magically prune old TrueNAS-named snapshots.&#10;That is a feature, not a bug.&#10;I would rather manually decide when old snapshots age out than have a new tool silently &amp;ldquo;clean up&amp;rdquo; history.&lt;/p&gt;&#10;&lt;p&gt;Incus is another subtle one.&#10;The storage pool lives on a data pool, so disko will not touch it.&#10;But a fresh NixOS install has a fresh Incus database.&#10;The plan is to run &lt;code&gt;incus admin recover&lt;/code&gt;, then apply a small declarative reconciler for the known instances.&#10;The state boundary has to be clear: preserve the storage dataset, recover the Incus database, then reconcile the instance config.&lt;/p&gt;&#10;&lt;p&gt;Health monitoring is also declared:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;SMARTD&lt;/li&gt;&#10;&lt;li&gt;ZFS Event Daemon&lt;/li&gt;&#10;&lt;li&gt;NUT/UPS client&lt;/li&gt;&#10;&lt;li&gt;Netdata bound locally&lt;/li&gt;&#10;&lt;li&gt;Prometheus exporters&lt;/li&gt;&#10;&lt;li&gt;A shared alert hook that can log, wall, and optionally send ntfy alerts&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;TrueNAS gives you many of these things in the UI.&#10;NixOS gives them to me as code.&lt;/p&gt;&#10;&lt;p&gt;I know using your NAS for other services is a bit of an anti-pattern.&#10;In an ideal world, the storage box just stores data and stays boring.&#10;But when I originally bought and configured this machine, it became the most powerful machine in my home lab.&#10;So it naturally started attracting the Docker workloads too.&#10;Most of those workloads are not resource intensive, and keeping them close to the data is genuinely convenient.&#10;At one point I was running more than a hundred containers on that machine and it barely made a dent.&#10;They ran inside LXC containers on Incus rather than directly on the TrueNAS host, which made it feel like a reasonable compromise for a long time.&lt;/p&gt;&#10;&lt;p&gt;The migration also became a chance to fix a real operational problem.&#10;My worst TrueNAS incident was a long OOM death spiral: no swap, too many unbounded containers, and services repeatedly getting killed and restarted.&#10;The philosophy came from Nix and open infrastructure.&#10;The OOM incident was the practical reminder that the NAS had become a general-purpose compute host.&#10;In the NixOS version, container memory limits, zram, earlyoom, and an explicit ZFS ARC cap are part of the configuration instead of being tribal knowledge or post-incident notes.&lt;/p&gt;&#10;&lt;h2 id="secrets-stay-out-of-the-repo"&gt;Secrets stay out of the repo &lt;a class="anchor" href="#secrets-stay-out-of-the-repo" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My dotfiles are public.&#10;That makes the migration more interesting.&lt;/p&gt;&#10;&lt;p&gt;The Nix config necessarily contains some operational facts: hostnames, share names, service definitions, and so on.&#10;But the plan deliberately keeps secrets and sensitive cutover material out of git.&lt;/p&gt;&#10;&lt;p&gt;For this migration, that means:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;ZFS dataset passphrases and unlock material stay off-box and outside the repo.&lt;/li&gt;&#10;&lt;li&gt;Replication private keys are installed manually under &lt;code&gt;/etc/ssh&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Inbound authorized keys for backup senders are installed during cutover.&lt;/li&gt;&#10;&lt;li&gt;Alerting secrets live in a runtime env file.&lt;/li&gt;&#10;&lt;li&gt;A local &lt;code&gt;~/nas-cutover/&lt;/code&gt; staging directory can exist, but it is explicitly not part of the repo and should not be casually read by agents.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;One important detail: the encrypted datasets use passphrase keys.&#10;In the TrueNAS setup I handled that with &lt;a href="https://github.com/basnijholt/truenas-unlock" target="_blank" rel="noopener"&gt;truenas-unlock&lt;/a&gt;, a small tool I wrote for this exact problem.&#10;The unlock material lives on another device; when that device is on the same network, it can unlock the datasets through the TrueNAS API.&#10;That gave me a lightweight hardware/network-presence factor: the NAS could boot, and the encrypted datasets only unlocked when the separate unlock device was present too.&lt;/p&gt;&#10;&lt;p&gt;That changes the migration footgun.&#10;The TrueNAS API path does not survive the cutover as-is, so I split the same idea out into &lt;a href="https://github.com/basnijholt/zfs-unlock" target="_blank" rel="noopener"&gt;zfs-unlock&lt;/a&gt;: the NixOS/OpenZFS version that talks to a restricted SSH receiver instead.&#10;During the migration I still kept an independent manual passphrase recovery path, because I do not want the automatic unlock mechanism to be the only way back into my data.&lt;/p&gt;&#10;&lt;h2 id="where-this-leaves-truenas"&gt;Where this leaves TrueNAS &lt;a class="anchor" href="#where-this-leaves-truenas" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I still like TrueNAS.&#10;It got me very far.&#10;It made ZFS approachable.&#10;It gave me a good NAS UI when I wanted a NAS UI.&#10;And if you want an appliance that mostly owns storage for you, it is still a very compelling project.&lt;/p&gt;&#10;&lt;p&gt;I like NixOS more for my own infrastructure.&#10;The most important machine in my house should live in reviewable code instead of mutable appliance state spread across a UI, a database, and old debugging decisions.&#10;NixOS and AI are a particularly good match for that.&#10;I can describe messy infrastructure intent in imprecise English, let the agent turn that into exact Nix code, and review the diff before it becomes system state.&#10;The prompt stays fuzzy.&#10;The machine state does not.&lt;/p&gt;&#10;&lt;p&gt;After the Proxmox migration, TrueNAS was the last major exception.&#10;This migration removes that exception.&lt;/p&gt;&#10;&lt;h2 id="the-cutover"&gt;The cutover &lt;a class="anchor" href="#the-cutover" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I ended up using a phased &lt;a href="https://github.com/nix-community/nixos-anywhere" target="_blank" rel="noopener"&gt;&lt;code&gt;nixos-anywhere&lt;/code&gt;&lt;/a&gt; cutover instead of the USB installer path.&#10;The important safety property stayed the same: first kexec into a temporary NixOS installer, stop there, run the disk preflight from inside that installer, and only then run the destructive &lt;code&gt;disko,install,reboot&lt;/code&gt; phase.&#10;Before the destructive phase, the box was running the installer in RAM and the disks had not been intentionally modified yet.&#10;That gave me a real checkpoint where aborting was still cheap.&lt;/p&gt;&#10;&lt;p&gt;I kept my hands on the few commands that actually changed the machine.&#10;I ran the &lt;code&gt;nixos-anywhere&lt;/code&gt; phases and the later &lt;code&gt;nixos-rebuild&lt;/code&gt; commands myself.&#10;The agent stayed next to it, reading the outputs, checking the assumptions, SSHing in to verify pool health, services, mounts, Incus state, NFS clients, and then turning any findings back into code or documentation.&#10;That split felt right to me: I pressed enter on the small number of irreversible commands, and the AI did the tedious verification work that I would otherwise be tempted to rush.&lt;/p&gt;&#10;&lt;p&gt;The actual migration was almost anticlimactic compared to the preparation.&#10;From the moment TrueNAS stopped being the running OS to having the Incus containers back with my hundred-plus services running again took less than 20 minutes.&#10;The slow work was not the cutover.&#10;The slow work was making the cutover boring.&lt;/p&gt;&#10;&lt;details&gt;&#10;&lt;summary&gt;The small things that still needed fixing during cutover&lt;/summary&gt;&#10;&lt;p&gt;There were a few small first-boot reconciliations. I am writing them down mostly for future readers who want to follow a similar path:&lt;/p&gt;&#10;&lt;ul&gt;&#10; &lt;li&gt;imported data-pool mountpoints needed to be reconciled to the &lt;code&gt;/mnt/...&lt;/code&gt; paths my clients and services already used;&lt;/li&gt;&#10; &lt;li&gt;encrypted datasets needed a better manual post-boot unlock helper, and the old TrueNAS API unlock flow needed a NixOS/OpenZFS successor;&lt;/li&gt;&#10; &lt;li&gt;Incus needed &lt;code&gt;incus admin recover&lt;/code&gt; because the storage pool survived but the new OS had a fresh Incus database;&lt;/li&gt;&#10; &lt;li&gt;one unprivileged recovered container needed the matching subordinate UID/GID ranges declared for its passthrough idmap;&lt;/li&gt;&#10; &lt;li&gt;&lt;code&gt;nas.local&lt;/code&gt; needed an explicit DNS record so my wildcard did not send it to a workload container;&lt;/li&gt;&#10; &lt;li&gt;the old PC job that backed up the TrueNAS API config needed to be removed;&lt;/li&gt;&#10; &lt;li&gt;the PC NFS mounts, Nix cache endpoints, and recovered Docker workload container all needed client-side validation.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Those findings went back into the cutover runbooks and the Nix config in a &lt;a href="https://github.com/basnijholt/dotfiles/pull/62"&gt;follow-up PR&lt;/a&gt;, so the notes are available for anyone who might benefit from them later.&lt;/p&gt;&#10;&lt;/details&gt;&#10;&lt;p&gt;At the end of the cutover, the machine was &lt;code&gt;nas&lt;/code&gt;, the ZFS pools were healthy, the NFS mounts worked from my PC, the Incus containers were recovered, and the Docker workloads were running again.&#10;SMB authentication, guest access, Time Machine, and normal media browsing from macOS Finder worked after one final share-root permission fix.&#10;At that point the migration was working end to end: the pools were healthy and the services I actually use were back.&lt;/p&gt;&#10;&lt;h2 id="references"&gt;References &lt;a class="anchor" href="#references" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;I&amp;rsquo;ve gone full Nix: Proxmox to NixOS + Incus&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/homelab/"&gt;My homelab: from a single Raspberry Pi to a Proxmox cluster and a dedicated NAS&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;On agentic coding&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://forums.truenas.com/t/clearing-the-air-on-build-scripts/64357" target="_blank" rel="noopener"&gt;TrueNAS forum: Clearing the Air on Build Scripts&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/truenas/scale-build" target="_blank" rel="noopener"&gt;&lt;code&gt;truenas/scale-build&lt;/code&gt; on GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://forums.truenas.com/t/truenas-closing-its-build-system-has-sparked-a-significant-trust-crisis-in-the-self-hosted-and-engineering-communities/64549" target="_blank" rel="noopener"&gt;TrueNAS forum: build-system trust crisis discussion&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.truenas.com/docs/scale/25.04/" target="_blank" rel="noopener"&gt;TrueNAS 25.04 documentation&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.truenas.com/blog/truenas-fangtooth-25-04-1/" target="_blank" rel="noopener"&gt;TrueNAS 25.04.1: Fangtooth Unification Gains Momentum&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://forums.truenas.com/t/truenas-virtualization-plans-for-25-04-2/46236" target="_blank" rel="noopener"&gt;TrueNAS Virtualization Plans for 25.04.2&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://forums.truenas.com/t/truenas-25-04-2-is-now-available/49165" target="_blank" rel="noopener"&gt;TrueNAS 25.04.2 release announcement&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://forums.truenas.com/t/linux-jails-containers-vms-with-incus/23599?page=21" target="_blank" rel="noopener"&gt;Linux Jails with Incus forum thread&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/Jip-Hop/jailmaker" target="_blank" rel="noopener"&gt;Jailmaker&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/truenas-unlock" target="_blank" rel="noopener"&gt;truenas-unlock&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/zfs-unlock" target="_blank" rel="noopener"&gt;zfs-unlock&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/pull/61" target="_blank" rel="noopener"&gt;The NAS NixOS scaffold PR&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>MindRoom: AI agents that live in Matrix and work everywhere 🧠</title><link>https://www.nijho.lt/post/mindroom/</link><pubDate>Fri, 26 Jun 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/mindroom/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-the-problem-your-ai-is-trapped-in-apps"&gt;1. The problem: your AI is trapped in apps&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-what-is-mindroom"&gt;2. What is MindRoom?&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-how-it-actually-works"&gt;3. How it actually works&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-building-on-matrix-the-good-and-the-tricky"&gt;4. Building on Matrix: the good and the tricky&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-memory-that-follows-you"&gt;5. Memory that follows you&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-100-built-in-tool-integrations"&gt;6. 100+ built-in tool integrations&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-teams-agents-that-collaborate"&gt;7. Teams: agents that collaborate&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-hot-reload-change-config-and-plugins-without-downtime"&gt;8. Hot-reload: change config and plugins without downtime&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-voice-scheduling-and-other-features"&gt;9. Voice, scheduling, and other features&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#10-the-obsession-the-saas-dream-and-the-burnout"&gt;10. The obsession, the SaaS dream, and the burnout&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#11-openclaw-and-why-it-matters"&gt;11. OpenClaw and why it matters&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#12-whats-next"&gt;12. What&amp;rsquo;s next&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#links-and-resources"&gt;Links and resources&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-the-problem-your-ai-is-trapped-in-apps"&gt;1. The problem: your AI is trapped in apps &lt;a class="anchor" href="#1-the-problem-your-ai-is-trapped-in-apps" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Programming is my biggest passion in life.&#10;I&amp;rsquo;ve been actively involved in open source for over ten years now, maintaining &lt;a href="https://github.com/basnijholt" target="_blank" rel="noopener"&gt;40+ installable packages&lt;/a&gt; across Python, JavaScript, and Rust.&#10;Some of these have over 100,000 users; others have exactly one—me.&#10;I mention this because it matters for what comes next: when AI coding tools arrived, I didn&amp;rsquo;t start from zero.&#10;As I wrote about in my &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;agentic coding post&lt;/a&gt;, AI has completely transformed how I work—when I&amp;rsquo;m AFK, I regularly build full features or entire projects by &lt;a href="https://www.nijho.lt/post/agentic-mobile-workflow/"&gt;dictating to my phone&lt;/a&gt; and routing it through my own &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;transcription software&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Through all of this, I became deeply convinced that AI agents are the future.&#10;Not just a useful tool for programmers—a fundamental shift in how &lt;em&gt;everyone&lt;/em&gt; will interact with computers.&lt;/p&gt;&#10;&lt;p&gt;But if that&amp;rsquo;s true, then the way agents work today is broken.&lt;/p&gt;&#10;&lt;p&gt;We&amp;rsquo;ve built artificial barriers between artificial intelligences.&#10;ChatGPT knows you in one tab, Claude knows you in another, your Slack bot knows you in a third.&#10;Your email AI can&amp;rsquo;t tell your calendar AI about that meeting invitation.&#10;Your coding assistant has no idea about the project specs sitting in your document AI.&#10;Switch platforms, and your AI starts from scratch.&lt;/p&gt;&#10;&lt;p&gt;Most agent frameworks require you to &lt;em&gt;program&lt;/em&gt; them.&#10;That works for developers like me, but if agents are truly the future, they need to work for everyone.&#10;Non-programmers don&amp;rsquo;t want to write code—they just want a chat.&lt;/p&gt;&#10;&lt;p&gt;And then there&amp;rsquo;s privacy.&#10;I&amp;rsquo;m fine sharing my email with Gemini—Google already owns my Gmail.&#10;But do I want to send my financial data, my health records, or my personal notes to a cloud provider?&#10;Not really.&#10;I&amp;rsquo;d rather use a local model for sensitive tasks and pick the best, cheapest Chinese model for general-purpose deep research.&lt;/p&gt;&#10;&lt;p&gt;So I built &lt;strong&gt;MindRoom&lt;/strong&gt; on a chat protocol—if people just want a chat, give them a chat.&#10;Agents live in the same rooms as you, collaborate in threads, and follow you across every platform.&#10;The first commit landed on July 29, 2025 (four months before OpenClaw&amp;rsquo;s first commit 😅), so by the time I&amp;rsquo;m publishing this MindRoom has been with me for nearly eleven months: first as an obsessive side project, then, since March, with much more sustained focus.&#10;At first I got so obsessed with it that I eventually burned out and had to step away completely.&lt;/p&gt;&#10;&lt;p&gt;Recently, seeing &lt;a href="https://openclaw.ai" target="_blank" rel="noopener"&gt;OpenClaw&lt;/a&gt; gain massive traction solving a similar problem reminded me that what I&amp;rsquo;d been building wasn&amp;rsquo;t just a niche obsession.&#10;So here I am, dusting off MindRoom and writing about what it is, how it works, and why I think the approach still matters.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; MindRoom is an open-source system that creates AI agents living inside the &lt;a href="https://matrix.org/" target="_blank" rel="noopener"&gt;Matrix protocol&lt;/a&gt;.&#10;Because Matrix has bridges to Slack, Telegram, Discord, WhatsApp, and everything else, your agents can follow you across every platform—with persistent memory, 100+ built-in tool integrations, and multi-agent collaboration.&#10;Think of it as &amp;ldquo;your AI assistant, but it lives in Matrix and works everywhere.&amp;rdquo;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;figure id="figure-live-chatmindroomchat-personal-thread-with-the-prompt-explain-how-mindroom-and-what-you-can-do-mind-answers-in-the-real-matrix-room-using-tool-calls-and-the-codex-backed-local-mindroom-runtime"&gt;&lt;img src="https://www.nijho.lt/post/mindroom/mindroom-in-action_hu_5c1001a61c1ce0a1.webp" srcset="https://www.nijho.lt/post/mindroom/mindroom-in-action_hu_cba228417596d894.webp 400w, https://www.nijho.lt/post/mindroom/mindroom-in-action_hu_5c1001a61c1ce0a1.webp 760w, https://www.nijho.lt/post/mindroom/mindroom-in-action_hu_46631ca52a25e910.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="489" alt="Live MindRoom Personal thread showing the prompt Explain how MindRoom and what you can do, followed by Mind explaining Matrix agents, tools, memory, and skills." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;Live chat.mindroom.chat Personal thread with the prompt: “Explain how MindRoom and what you can do.” Mind answers in the real Matrix room, using tool calls and the Codex-backed local MindRoom runtime.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;h2 id="2-what-is-mindroom"&gt;2. What is MindRoom? &lt;a class="anchor" href="#2-what-is-mindroom" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;MindRoom is an open-source system that creates AI agents living inside the &lt;a href="https://matrix.org/" target="_blank" rel="noopener"&gt;Matrix protocol&lt;/a&gt;.&#10;If you&amp;rsquo;re not familiar with Matrix—it&amp;rsquo;s a federated, end-to-end encrypted communication standard.&#10;The same protocol used by the French government for 5.5 million civil servants, by German healthcare for 150K+ organizations, and by the Element app that millions of people use daily.&lt;/p&gt;&#10;&lt;p&gt;The key insight: Matrix has &lt;a href="https://matrix.org/ecosystem/bridges/" target="_blank" rel="noopener"&gt;bridges&lt;/a&gt; to many major platforms—Slack, Telegram, Discord, WhatsApp, IRC, email, even SMS.&lt;/p&gt;&#10;&lt;p&gt;So if your AI agent lives in Matrix, it can reach you on any platform.&#10;One agent, every platform, continuous memory.&lt;/p&gt;&#10;&lt;p&gt;One practical caveat: Matrix bridges vary in maturity. Some, like the &lt;a href="https://github.com/mautrix/telegram" target="_blank" rel="noopener"&gt;Telegram bridge&lt;/a&gt;, work very well, while others can be finicky. Your mileage may vary depending on which platforms you need.&lt;/p&gt;&#10;&lt;p&gt;Here&amp;rsquo;s what a typical setup looks like in &lt;code&gt;config.yaml&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;agents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;CodeAgent&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Generate code, manage files, execute shell commands&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;opus-4.8&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;file, shell, github]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;instructions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="l"&gt;Always read files before modifying them.&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;rooms&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;lobby, dev]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;research&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ResearchAgent&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Search the web, summarize papers, find information&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;gpt-5.5&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;tavily, arxiv, wikipedia]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;rooms&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;lobby, research]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;teams&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;super_team&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;display_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Super Team&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;agents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;code, research]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;collaborate&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Define your agents, give them tools and rooms, and they show up in Matrix as real users—with avatars, typing indicators, and online status.&lt;/p&gt;&#10;&lt;figure id="figure-mindroom-agents-are-real-matrix-users-with-their-own-accounts-generated-avatars-display-names-room-memberships-and-online-presence"&gt;&lt;img src="https://www.nijho.lt/post/mindroom/mindroom-members_hu_5090cd21f23bad91.webp" srcset="https://www.nijho.lt/post/mindroom/mindroom-members_hu_fbc884b2330f0fe3.webp 400w, https://www.nijho.lt/post/mindroom/mindroom-members_hu_5090cd21f23bad91.webp 760w, https://www.nijho.lt/post/mindroom/mindroom-members_hu_e6a566cfcdf2d915.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="489" alt="Live MindRoom room showing RouterAgent, Mind, and Bas as Matrix users with generated avatars." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;MindRoom agents are real Matrix users with their own accounts, generated avatars, display names, room memberships, and online presence.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;h2 id="3-how-it-actually-works"&gt;3. How it actually works &lt;a class="anchor" href="#3-how-it-actually-works" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;At the core sits what I call the &lt;strong&gt;MultiAgentOrchestrator&lt;/strong&gt;—a class in &lt;code&gt;bot.py&lt;/code&gt; that boots every configured entity (router, agents, teams), provisions Matrix user accounts for each one via &lt;a href="https://github.com/matrix-nio/matrix-nio" target="_blank" rel="noopener"&gt;matrix-nio&lt;/a&gt;, and keeps sync loops alive.&#10;The agents themselves are powered by the &lt;a href="https://github.com/agno-agi/agno" target="_blank" rel="noopener"&gt;Agno&lt;/a&gt; framework, which provides a unified interface across AI model providers.&lt;/p&gt;&#10;&lt;p&gt;When someone sends a message in a Matrix room:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Explicit mentions&lt;/strong&gt; go directly to the named agent (&lt;code&gt;@mindroom_code help me debug this&lt;/code&gt;)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Thread continuations&lt;/strong&gt; keep the same agent responding (no weird context switches mid-conversation)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;New conversations&lt;/strong&gt; hit the &lt;strong&gt;router&lt;/strong&gt;—an AI that analyzes the message and picks the best agent based on capabilities&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;All conversations happen in threads, which keeps rooms organized.&#10;Agents stream their responses in real-time, editing a single message as they think rather than spamming new ones.&#10;You see tool calls happening live:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;🔧 Tool Call: search_web(query=&amp;#34;matrix protocol bridges&amp;#34;)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[waiting for result...]&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;✅ search_web result:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;[results here]&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The recording below starts in the main Personal room, sends the prompt &lt;code&gt;Explain how MindRoom and what you can do.&lt;/code&gt;, and then follows MindRoom as it opens the new thread and streams the reply to completion. It is sped up 2.5x to keep the flow skimmable.&lt;/p&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/reduced-motion.3dfea0061c17c60a9a200c61ef1e3b3e98d5bdc4eaa4e0a64b3ed2a4d13c72fd.js" integrity="sha256-Pf6gBhwXxgqaIAxh7x47PpjVvcTqpOCmSz7SpNE8cv0=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;video controls autoplay muted playsinline loop preload="metadata"&gt;&#10;&lt;source src="https://www.nijho.lt/post/mindroom/mindroom-agent-response.mp4" type="video/mp4"&gt;&#10;&lt;/video&gt;&#10;&#10;&lt;h2 id="4-building-on-matrix-the-good-and-the-tricky"&gt;4. Building on Matrix: the good and the tricky &lt;a class="anchor" href="#4-building-on-matrix-the-good-and-the-tricky" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of the best things about building on Matrix is what you get for free.&#10;End-to-end encryption, a deeply interoperable chat protocol with bridges to many platforms, a choice of clients, federation between organizations—all of that comes with the protocol.&#10;You don&amp;rsquo;t have to build any of it yourself.&lt;/p&gt;&#10;&lt;p&gt;But because Matrix has such a tight specification, it also brings challenges.&lt;/p&gt;&#10;&lt;p&gt;The protocol doesn&amp;rsquo;t support streaming.&#10;AI agents that think for 30 seconds before dumping a wall of text make for a terrible chat experience, so I hacked streaming in by rapidly editing the same message as new tokens arrive.&#10;An &lt;code&gt;⋯&lt;/code&gt; marker shows while the agent is still thinking—a small touch, but it makes the experience feel responsive and alive.&lt;/p&gt;&#10;&lt;p&gt;There&amp;rsquo;s also a size limit on message content.&#10;That&amp;rsquo;s fine for human chat, but AI responses can get long—especially when tool calls and their results are included.&#10;I worked around this by using Matrix&amp;rsquo;s attachment feature: when a response exceeds the limit, the content continues in an attachment that gets updated as the message keeps streaming in.&#10;This required forking the &lt;a href="https://cinny.in/" target="_blank" rel="noopener"&gt;Cinny&lt;/a&gt; chat client so that attachments display inline rather than as downloadable files, making the whole thing seamless.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;These workarounds are the kind of thing you don&amp;rsquo;t anticipate when you pick a protocol.&#10;Matrix gives you an incredible foundation, but making it work well for AI required bending it in ways it wasn&amp;rsquo;t designed for.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="5-memory-that-follows-you"&gt;5. Memory that follows you &lt;a class="anchor" href="#5-memory-that-follows-you" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;MindRoom currently supports two memory implementations.&lt;/p&gt;&#10;&lt;p&gt;The first is the more traditional semantic memory system built on &lt;a href="https://mem0.ai/" target="_blank" rel="noopener"&gt;Mem0&lt;/a&gt;&amp;rsquo;s &lt;code&gt;AsyncMemory&lt;/code&gt;, with configurable embedding providers (&lt;a href="https://platform.openai.com/docs/guides/embeddings" target="_blank" rel="noopener"&gt;OpenAI&lt;/a&gt;, &lt;a href="https://ollama.com/" target="_blank" rel="noopener"&gt;Ollama&lt;/a&gt;, or HuggingFace) and vector storage via &lt;a href="https://www.trychroma.com/" target="_blank" rel="noopener"&gt;ChromaDB&lt;/a&gt;.&#10;This gives agents searchable memory for preferences, project context, decisions, and recurring facts.&lt;/p&gt;&#10;&lt;p&gt;The second is a file-based memory system inspired by the simplicity of OpenClaw-style agent files.&#10;Instead of burying identity in a database, durable context can live in plain Markdown files that travel with the agent.&#10;That portability matters: I can move the same agent identity from OpenClaw to Hermes to MindRoom without starting from scratch.&lt;/p&gt;&#10;&lt;p&gt;MindRoom also has a memory flush step that periodically extracts durable facts from conversations and writes them back into memory.&#10;So the chat transcript remains chat, while stable preferences, decisions, and identity details become reusable context for future turns.&lt;/p&gt;&#10;&lt;figure id="figure-a-live-personal-memory-demo-mindroom-stores-a-harmless-preference-in-one-turn-and-retrieves-it-later-from-the-same-matrix-conversation"&gt;&lt;img src="https://www.nijho.lt/post/mindroom/mindroom-memory_hu_5090cd21f23bad91.webp" srcset="https://www.nijho.lt/post/mindroom/mindroom-memory_hu_fbc884b2330f0fe3.webp 400w, https://www.nijho.lt/post/mindroom/mindroom-memory_hu_5090cd21f23bad91.webp 760w, https://www.nijho.lt/post/mindroom/mindroom-memory_hu_e6a566cfcdf2d915.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="489" alt="Live MindRoom memory thread showing the generated agent avatars and a public demo where the agent remembers teal as the blog demo accent color." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;A live Personal memory demo: MindRoom stores a harmless preference in one turn and retrieves it later from the same Matrix conversation.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;h2 id="6-100-built-in-tool-integrations"&gt;6. 100+ built-in tool integrations &lt;a class="anchor" href="#6-100-built-in-tool-integrations" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Agents can use over 100 built-in integrations:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Category&lt;/th&gt;&#10;&lt;th&gt;Examples&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Communication&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Gmail, Slack, Telegram, Discord&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Development&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;GitHub, Shell, Python, Docker&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Search&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Tavily, Wikipedia, Arxiv, DuckDuckGo&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Productivity&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Google Calendar, Jira, Linear, Todoist&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Smart Home&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Home Assistant&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;AI/ML&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;DALL-E, ElevenLabs, Replicate&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Data&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Pandas, SQL, DuckDB, Yahoo Finance&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;strong&gt;Web&lt;/strong&gt;&lt;/td&gt;&#10;&lt;td&gt;Firecrawl, Crawl4ai, Browser automation&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Tools are lazy-loaded and credential-managed, so an agent only loads what it needs.&lt;/p&gt;&#10;&lt;h2 id="7-teams-agents-that-collaborate"&gt;7. Teams: agents that collaborate &lt;a class="anchor" href="#7-teams-agents-that-collaborate" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Single agents are useful, but sometimes you need a team.&#10;MindRoom supports two collaboration modes:&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Coordinate mode&lt;/strong&gt;: A lead agent orchestrates others.&#10;You ask a question, the lead delegates subtasks, collects results, and synthesizes a unified response.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Collaborate mode&lt;/strong&gt;: All agents work on the same task in parallel, each providing their independent analysis.&#10;The system then merges their responses with a consensus summary.&lt;/p&gt;&#10;&lt;p&gt;In practice, you might have a research team where one agent searches academic papers, another checks industry news, and a third validates claims—all triggered by a single message.&#10;The live room view below shows a real team response in the same Matrix thread surface normal agents use: threads, routed agents, and room history are all first-class chat objects rather than a separate dashboard.&lt;/p&gt;&#10;&lt;figure id="figure-live-lobby-thread-in-chatmindroomchat-showing-a-real-team-response-from-homeassistant-and-agentbuilder-team-collaboration-uses-the-same-matrix-native-interface-as-regular-agent-chats-with-routed-agents-and-room-membership-visible-beside-the-conversation"&gt;&lt;img src="https://www.nijho.lt/post/mindroom/mindroom-team_hu_afbbb6ff5ac54e3f.webp" srcset="https://www.nijho.lt/post/mindroom/mindroom-team_hu_bf973e9c13f8cf6.webp 400w, https://www.nijho.lt/post/mindroom/mindroom-team_hu_afbbb6ff5ac54e3f.webp 760w, https://www.nijho.lt/post/mindroom/mindroom-team_hu_ee227208566f8d1.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="533" alt="Live MindRoom Lobby thread showing a Team Response from HomeAssistant and AgentBuilder, with the member list showing Super Team and other agents." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;Live Lobby thread in chat.mindroom.chat showing a real Team Response from HomeAssistant and AgentBuilder. Team collaboration uses the same Matrix-native interface as regular agent chats, with routed agents and room membership visible beside the conversation.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;h2 id="8-hot-reload-change-config-and-plugins-without-downtime"&gt;8. Hot-reload: change config and plugins without downtime &lt;a class="anchor" href="#8-hot-reload-change-config-and-plugins-without-downtime" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;config.yaml&lt;/code&gt; is watched at runtime.&#10;When you edit it—add an agent, change a model, update instructions—MindRoom diffs the old and new config, gracefully restarts only the affected agents, and has them rejoin their rooms.&#10;No downtime, no full runtime restart required.&lt;/p&gt;&#10;&lt;p&gt;The same development loop applies to plugins.&#10;MindRoom has a rich Python hook system, and plugins can be live-developed while the system is running.&#10;Change a plugin file, save it, and MindRoom automatically reloads the plugin without restarting the Python runtime.&lt;/p&gt;&#10;&lt;p&gt;This sounds minor, but when you&amp;rsquo;re iterating on agent behavior or plugin hooks, being able to tweak code and config and see results in seconds significantly improves the development loop.&lt;/p&gt;&#10;&#10;&lt;script type="module" src="https://www.nijho.lt/js/reduced-motion.3dfea0061c17c60a9a200c61ef1e3b3e98d5bdc4eaa4e0a64b3ed2a4d13c72fd.js" integrity="sha256-Pf6gBhwXxgqaIAxh7x47PpjVvcTqpOCmSz7SpNE8cv0=" crossorigin="anonymous"&gt;&lt;/script&gt;&#10;&lt;video controls autoplay muted playsinline loop preload="metadata"&gt;&#10;&lt;source src="https://www.nijho.lt/post/mindroom/mindroom-hot-reload.mp4" type="video/mp4"&gt;&#10;&lt;/video&gt;&#10;&#10;&lt;h2 id="9-voice-scheduling-and-other-features"&gt;9. Voice, scheduling, and other features &lt;a class="anchor" href="#9-voice-scheduling-and-other-features" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Some features I built purely because I wanted them for myself (a recurring theme in my projects, as anyone who&amp;rsquo;s read my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local AI journey&lt;/a&gt; can attest).&#10;I even built &lt;a href="https://github.com/basnijholt/matty" target="_blank" rel="noopener"&gt;Matty&lt;/a&gt;, a Matrix CLI client, from bed at midnight because I needed a way to interact with my agents from the terminal:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Voice messages&lt;/strong&gt;: Audio messages in Matrix are auto-transcribed via Whisper and treated as regular text input.&#10;You can talk to your agents.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Scheduled tasks&lt;/strong&gt;: Natural language scheduling (&lt;code&gt;!schedule &amp;quot;check my email every morning at 9 AM&amp;quot;&lt;/code&gt;) backed by cron jobs.&#10;Agents can run tasks in the background and escalate to you when needed.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;DM support&lt;/strong&gt;: Agents respond naturally in 1:1 conversations without needing mentions.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Cross-organization federation&lt;/strong&gt;: Because Matrix is federated, two companies&amp;rsquo; AI agents can collaborate in a shared room—something that&amp;rsquo;s hard to do on proprietary platforms.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;The voice feature pairs nicely with my &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; tool—local Whisper transcription on my RTX 3090 means I can talk to my Matrix agents without any cloud dependency.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="10-the-obsession-the-saas-dream-and-the-burnout"&gt;10. The obsession, the SaaS dream, and the burnout &lt;a class="anchor" href="#10-the-obsession-the-saas-dream-and-the-burnout" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I need to be honest about what actually happened with MindRoom, because &amp;ldquo;life got in the way&amp;rdquo; is a sanitized version of the story.&lt;/p&gt;&#10;&lt;p&gt;What really happened is that I got completely, utterly obsessed.&#10;Every single second I wasn&amp;rsquo;t working at my day job or sleeping, I was working on MindRoom.&#10;Many hundreds of hours went into it.&#10;I seriously considered quitting my job and starting an AI startup around it.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;ve read Armin Ronacher&amp;rsquo;s post &lt;a href="https://lucumr.pocoo.org/2026/1/18/agent-psychosis/" target="_blank" rel="noopener"&gt;Agent Psychosis: Are We Going Insane?&lt;/a&gt;, you&amp;rsquo;ll know exactly what I&amp;rsquo;m talking about.&#10;The dopamine hit from building with AI agents is incredibly real.&#10;As Armin writes: &amp;ldquo;You feel productive, you feel like everything is amazing, and if you hang out just with people that are into that stuff too, without any checks, you go deeper and deeper into the belief that this all makes perfect sense.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;That was me.&#10;I was building and building, shipping feature after feature, and it felt incredible.&#10;The codebase grew to over 1,000 commits.&#10;I built the core system, then a React dashboard, then I started on a full SaaS platform—Kubernetes deployments on Hetzner Cloud, a FastAPI backend, a Next.js 15 frontend, Stripe integration, Supabase auth, Helm charts for multi-tenant isolation.&lt;/p&gt;&#10;&lt;p&gt;And that&amp;rsquo;s where the enthusiasm started to erode.&#10;Not because the core idea was bad, but because the work shifted from building interesting things (agent orchestration, memory systems, routing intelligence) to grinding through SaaS boilerplate: GDPR compliance, payment processing, automated Kubernetes deployments, terms of service, cookie banners.&#10;The dopamine loop that kept me going at 2 AM broke when the work stopped being creative and started being compliance paperwork.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Looking back, I think this is a pattern worth recognizing.&#10;Agentic coding makes it so easy to &lt;em&gt;start&lt;/em&gt; things that you can build yourself into a scope that would normally require a team.&#10;The gap between &amp;ldquo;I can build this&amp;rdquo; and &amp;ldquo;I can maintain and ship this as a product&amp;rdquo; is larger than the tools make it feel.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;The hosted control plane lives at &lt;a href="https://app.mindroom.chat" target="_blank" rel="noopener"&gt;app.mindroom.chat&lt;/a&gt;.&#10;I am deliberately not turning this section into a dashboard tour; the interesting part, and the part I still care about most, is the Matrix-native runtime underneath it.&lt;/p&gt;&#10;&lt;h2 id="11-openclaw-and-why-it-matters"&gt;11. OpenClaw and why it matters &lt;a class="anchor" href="#11-openclaw-and-why-it-matters" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://openclaw.ai" target="_blank" rel="noopener"&gt;OpenClaw&lt;/a&gt; takes a different approach to the same core problem.&#10;Where MindRoom builds on Matrix federation as the backbone, OpenClaw runs a local Gateway on your machine and connects to messaging platforms directly (WhatsApp via Baileys, Telegram via grammY, Discord via discord.js, and so on).&lt;/p&gt;&#10;&lt;p&gt;The similarities are striking:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Both give you a single AI assistant across all your messaging platforms&lt;/li&gt;&#10;&lt;li&gt;Both have persistent memory&lt;/li&gt;&#10;&lt;li&gt;Both support multiple tools and integrations&lt;/li&gt;&#10;&lt;li&gt;Both are open-source and privacy-focused&lt;/li&gt;&#10;&lt;li&gt;Both let you choose your own AI model&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The differences are interesting too.&#10;OpenClaw is local-first and TypeScript-based with 380K+ stars and a massive community.&#10;MindRoom is Python-based, federation-first, and&amp;hellip; well, let&amp;rsquo;s just say my GitHub star count is a few orders of magnitude lower.&lt;/p&gt;&#10;&lt;p&gt;But seeing OpenClaw validate the core idea—that people want AI assistants that aren&amp;rsquo;t trapped in apps—reminded me that what I&amp;rsquo;d been building matters.&#10;The federation angle is something OpenClaw doesn&amp;rsquo;t have: the ability for agents from different organizations to collaborate natively, with end-to-end encryption (Olm/Megolm), on a protocol that governments already trust and deploy at scale.&lt;/p&gt;&#10;&lt;figure id="figure-mindroom-uses-matrix-as-the-federated-backbone-openclaw-takes-a-local-gateway-direct-connector-approach"&gt;&lt;img src="https://www.nijho.lt/post/mindroom/mindroom-architecture_hu_aaf71cef609b8340.webp" srcset="https://www.nijho.lt/post/mindroom/mindroom-architecture_hu_2cca5883511aed87.webp 400w, https://www.nijho.lt/post/mindroom/mindroom-architecture_hu_aaf71cef609b8340.webp 760w, https://www.nijho.lt/post/mindroom/mindroom-architecture_hu_afb78d90679bf4a4.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="507" alt="Architecture diagram comparing MindRoom and OpenClaw. MindRoom flows from user to Matrix room to federated homeserver to bridges to messaging platforms. OpenClaw flows from user to local gateway to direct connectors to platform APIs." loading="lazy" data-zoomable&gt;&lt;figcaption&gt;MindRoom uses Matrix as the federated backbone; OpenClaw takes a local-gateway, direct-connector approach.&lt;/figcaption&gt;&lt;/figure&gt;&#10;&lt;p&gt;And then there&amp;rsquo;s &lt;a href="https://moltbook.com" target="_blank" rel="noopener"&gt;Moltbook&lt;/a&gt;—a social network built exclusively for AI agents that the internet was losing its mind over for a couple of days.&#10;I&amp;rsquo;m not personally convinced it&amp;rsquo;s the next big thing, but what caught my attention is that MindRoom could support something like it &lt;em&gt;natively&lt;/em&gt;.&#10;Matrix is already federated—agents on different servers can already interact, join shared rooms, and collaborate across organizational boundaries.&#10;A bridge from a Reddit-like platform to Matrix and your agents could participate without any special integration.&lt;/p&gt;&#10;&lt;p&gt;Building agent-to-agent infrastructure from scratch also means building security from scratch—and that&amp;rsquo;s where new platforms tend to struggle.&#10;Matrix has spent years hardening its E2E encryption, and it&amp;rsquo;s already deployed by governments and healthcare organizations at scale.&#10;Building on that foundation means you inherit those security properties rather than hoping to get them right yourself.&lt;/p&gt;&#10;&lt;h2 id="12-whats-next"&gt;12. What&amp;rsquo;s next &lt;a class="anchor" href="#12-whats-next" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I first drafted this post a couple of months ago, when MindRoom was still something I was trying to come back to.&#10;That part is already out of date.&#10;Since January I&amp;rsquo;ve been spending nearly every free hour on it again, and since March it has effectively been my full-time work.&#10;The codebase supports 8+ AI model providers—OpenAI, Anthropic, Ollama, Groq, Google, OpenRouter, DeepSeek, Cerebras—and the core architecture is solid.&#10;It also has real users now.&#10;My rough guess is that something like 30-100 people have tried MindRoom in one form or another, which is still early, but meaningfully different from &amp;ldquo;only I have touched this.&amp;rdquo;&#10;There&amp;rsquo;s already a Docker Compose file and a &lt;a href="https://github.com/mindroom-ai/mindroom-stack" target="_blank" rel="noopener"&gt;starter repository&lt;/a&gt; to get started, but I want to make it even simpler.&lt;/p&gt;&#10;&lt;p&gt;What I&amp;rsquo;m focusing on now:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Skills system&lt;/strong&gt;: Building an ecosystem of reusable agent behaviors (already partially implemented with OpenClaw-compatible format)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Even easier onboarding&lt;/strong&gt;: A &lt;code&gt;docker compose up&lt;/code&gt; gets you running today, but I want a wizard that gets you from zero to working agents without touching a YAML file&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Community&lt;/strong&gt;: Turning the small group of early users into a real operator and contributor community&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Scope discipline&lt;/strong&gt;: Keeping the work sustainable now that MindRoom is effectively full-time, not slipping back into the obsessive 2 AM marathon from before&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I&amp;rsquo;m deliberately leaving the SaaS ambitions aside for now.&#10;The core system is what matters, and that&amp;rsquo;s where the energy is going.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re interested in AI agents that live in Matrix and work everywhere, check out &lt;a href="https://github.com/mindroom-ai/mindroom" target="_blank" rel="noopener"&gt;MindRoom on GitHub&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Sometimes seeing someone else succeed with a similar idea is enough to remember why you started building in the first place.&#10;And sometimes the most important lesson from a project isn&amp;rsquo;t technical—it&amp;rsquo;s learning when to step away and when to come back.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Are you running AI agents on any messaging platforms? Have you tried Matrix for anything beyond regular chat? I&amp;rsquo;d love to hear about your setups!&lt;/em&gt;&lt;/p&gt;&#10;&lt;h2 id="links-and-resources"&gt;Links and resources &lt;a class="anchor" href="#links-and-resources" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/mindroom-ai/mindroom" target="_blank" rel="noopener"&gt;MindRoom on GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/mindroom-ai/mindroom-stack" target="_blank" rel="noopener"&gt;MindRoom Stack (starter repository)&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://matrix.org/" target="_blank" rel="noopener"&gt;Matrix protocol&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openclaw.ai" target="_blank" rel="noopener"&gt;OpenClaw&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://mem0.ai/" target="_blank" rel="noopener"&gt;Mem0 (memory system inspiration)&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/agno-agi/agno" target="_blank" rel="noopener"&gt;Agno framework&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/matty" target="_blank" rel="noopener"&gt;Matty (Matrix CLI client)&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://lucumr.pocoo.org/2026/1/18/agent-psychosis/" target="_blank" rel="noopener"&gt;Agent Psychosis: Are We Going Insane?&lt;/a&gt; by Armin Ronacher&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;My agentic coding post&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;My local AI journey&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/agentic-mobile-workflow/"&gt;Coding from my phone&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>Auto-installing extras at runtime so users never have to think about dependencies</title><link>https://www.nijho.lt/post/auto-install-extras/</link><pubDate>Wed, 11 Feb 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/auto-install-extras/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-from-one-command-to-a-dependency-maze"&gt;1. From one command to a dependency maze&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-why-just-use-extras-breaks-down"&gt;2. Why &amp;ldquo;just use extras&amp;rdquo; breaks down&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-the-decorator"&gt;3. The decorator&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-checking-without-importing"&gt;4. Checking without importing&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-the-metadata-bridge"&gt;5. The metadata bridge&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-three-environments-three-strategies"&gt;6. Three environments, three strategies&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#a-uv-tool-install--the-persistent-environment"&gt;A) &lt;code&gt;uv tool install&lt;/code&gt; — the persistent environment&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#b-uvx--the-ephemeral-environment"&gt;B) &lt;code&gt;uvx&lt;/code&gt; — the ephemeral environment&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#c-regular-virtualenv-pipx-or-system-install"&gt;C) Regular virtualenv, &lt;code&gt;pipx&lt;/code&gt;, or system install&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-preventing-infinite-re-execution-loops"&gt;7. Preventing infinite re-execution loops&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-what-users-actually-see"&gt;8. What users actually see&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-keeping-everything-in-sync"&gt;9. Keeping everything in sync&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#10-why-uv-made-this-practical"&gt;10. Why uv made this practical&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#11-tradeoffs"&gt;11. Tradeoffs&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#12-not-dependency-injection"&gt;12. Not dependency injection&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#13-conclusion"&gt;13. Conclusion&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-from-one-command-to-a-dependency-maze"&gt;1. From one command to a dependency maze &lt;a class="anchor" href="#1-from-one-command-to-a-dependency-maze" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; started as a simple thing.&#10;Voice in, text out.&#10;It connected to a &lt;a href="https://github.com/rhasspy/wyoming" target="_blank" rel="noopener"&gt;Wyoming&lt;/a&gt; Whisper server for speech-to-text and a Piper server for text-to-speech, basically a local, open-source Siri triggered from terminal hotkeys.&#10;I wrote about the early version in my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local AI journey&lt;/a&gt; post.&lt;/p&gt;&#10;&lt;p&gt;And then, as tends to happen with side projects I use every day, I kept adding things.&lt;/p&gt;&#10;&lt;p&gt;First a RAG proxy with ChromaDB, so I could chat with my documents.&#10;Then a long-term memory system, so conversations could remember context across sessions.&#10;Server commands that run Kokoro TTS or Whisper locally, optimized for whatever hardware you have—Apple Silicon gets MLX, NVIDIA gets CTranslate2.&#10;Voice activity detection with Silero VAD.&#10;Audio speed adjustment.&#10;An &lt;a href="https://www.nijho.lt/post/parallel-agentic-coding/"&gt;agent orchestration system&lt;/a&gt;.&#10;&lt;code&gt;systemd&lt;/code&gt;/&lt;code&gt;launchd&lt;/code&gt; service management for running background daemons.&lt;/p&gt;&#10;&lt;p&gt;Each of these features pulled in wildly different dependency trees.&#10;&lt;code&gt;torch&lt;/code&gt; and &lt;code&gt;transformers&lt;/code&gt; for GPU-accelerated Whisper.&#10;&lt;code&gt;sounddevice&lt;/code&gt; and &lt;code&gt;numpy&lt;/code&gt; for microphone access.&#10;&lt;code&gt;chromadb&lt;/code&gt; and &lt;code&gt;onnxruntime&lt;/code&gt; for vector storage.&#10;&lt;code&gt;kokoro&lt;/code&gt; with its entire spacy pipeline for neural TTS.&lt;/p&gt;&#10;&lt;p&gt;Today the project has &lt;strong&gt;13 optional extras&lt;/strong&gt;.&#10;The tool became much more useful, but dependency UX got progressively worse with every feature.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I moved from &amp;ldquo;users choose extras upfront&amp;rdquo; to &lt;strong&gt;runtime optional dependency resolution&lt;/strong&gt;.&#10;Commands declare required extras with &lt;code&gt;@requires_extras(...)&lt;/code&gt;; if something is missing, &lt;code&gt;agent-cli&lt;/code&gt; installs it in the right environment and re-runs the command automatically.&#10;The user just types &lt;code&gt;agent-cli transcribe&lt;/code&gt; and everything works.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="2-why-just-use-extras-breaks-down"&gt;2. Why &amp;ldquo;just use extras&amp;rdquo; breaks down &lt;a class="anchor" href="#2-why-just-use-extras-breaks-down" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Python&amp;rsquo;s &lt;code&gt;optional-dependencies&lt;/code&gt; in &lt;code&gt;pyproject.toml&lt;/code&gt; is the standard mechanism for this, and it&amp;rsquo;s the right packaging primitive.&#10;You define groups, users install with &lt;code&gt;pip install agent-cli[rag]&lt;/code&gt;.&#10;On paper, this is perfectly reasonable.&lt;/p&gt;&#10;&lt;p&gt;In practice, it falls apart when you have 13 of them:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;optional-dependencies&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;audio&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;numpy&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;sounddevice&amp;gt;=0.4.6&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;agent-cli[wyoming]&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;llm&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;pydantic-ai-slim[openai,google,duckduckgo,vertexai]&amp;gt;=0.1.1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;rag&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;pydantic-ai-slim[openai,google]&amp;gt;=0.1.1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;chromadb&amp;gt;=0.4.22&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;memory&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;pydantic-ai-slim[openai,google]&amp;gt;=0.1.1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;chromadb&amp;gt;=0.4.22&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;vad&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;onnxruntime&amp;gt;=1.16.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;faster-whisper&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;faster-whisper&amp;gt;=1.0.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;mlx-whisper&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;mlx-whisper&amp;gt;=0.4.0; sys_platform == &amp;#39;darwin&amp;#39; and platform_machine == &amp;#39;arm64&amp;#39;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;kokoro&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;kokoro&amp;gt;=0.9.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;soundfile&amp;gt;=0.12.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;...]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;piper&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;piper-tts&amp;gt;=1.2.0&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# ... and more&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The UX problem is obvious.&#10;If I want to transcribe voice to text, do I need &lt;code&gt;audio&lt;/code&gt;? &lt;code&gt;llm&lt;/code&gt;? &lt;code&gt;vad&lt;/code&gt;? All three?&#10;What if I want the Whisper server to run locally—is that &lt;code&gt;faster-whisper&lt;/code&gt; or &lt;code&gt;mlx-whisper&lt;/code&gt;?&#10;Do I also need &lt;code&gt;server&lt;/code&gt; for that?&lt;/p&gt;&#10;&lt;p&gt;Expecting users to study a dependency matrix before running a CLI command is a terrible experience.&#10;I wanted three things:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;A lightweight base install that&amp;rsquo;s fast and doesn&amp;rsquo;t pull in heavy ML dependencies.&lt;/li&gt;&#10;&lt;li&gt;Commands that &amp;ldquo;just work&amp;rdquo; when first used.&lt;/li&gt;&#10;&lt;li&gt;A clear opt-out for people who don&amp;rsquo;t want automatic installs.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="3-the-decorator"&gt;3. The decorator &lt;a class="anchor" href="#3-the-decorator" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The core idea is simple.&#10;Each CLI command declares what it needs, and the decorator handles the rest:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@app.command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;transcribe&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rich_help_panel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Voice Commands&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@requires_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;audio&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;llm&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;transcribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it from the command author&amp;rsquo;s perspective.&#10;One line, and you never think about dependency management in that command again.&lt;/p&gt;&#10;&lt;p&gt;Here are a few more examples from the codebase to show how this scales:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Continuous transcription needs audio, voice activity detection, and an LLM&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@requires_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;audio&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;vad&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;llm&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;transcribe_live&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# TTS server needs the server framework + one of two TTS backends + Wyoming protocol&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@requires_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;server&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;piper|kokoro&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;wyoming&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;start_tts_server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Whisper server: any of three ASR backends will do&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@requires_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;server&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;faster-whisper|mlx-whisper|whisper-transformers&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;wyoming&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;start_whisper_server&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="o"&gt;...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice the pipe syntax: &lt;code&gt;&amp;quot;piper|kokoro&amp;quot;&lt;/code&gt; means &amp;ldquo;you need &lt;em&gt;either&lt;/em&gt; Piper &lt;em&gt;or&lt;/em&gt; Kokoro—any one of these satisfies the requirement.&amp;rdquo;&#10;On Apple Silicon, if you already have &lt;code&gt;mlx-whisper&lt;/code&gt; installed, it won&amp;rsquo;t try to install &lt;code&gt;faster-whisper&lt;/code&gt; instead.&lt;/p&gt;&#10;&lt;p&gt;The &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py#L365-L383" target="_blank" rel="noopener"&gt;decorator itself&lt;/a&gt; is straightforward:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;requires_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Callable&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;decorator&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nd"&gt;@functools.wraps&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;wrapper&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;_check_and_install_extras&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="n"&gt;typer&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Exit&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;kwargs&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;wrapper&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;decorator&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The real complexity lives in &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py#L321-L359" target="_blank" rel="noopener"&gt;&lt;code&gt;_check_and_install_extras&lt;/code&gt;&lt;/a&gt;, which handles several installation scenarios.&#10;But the interface for command authors is always a single line.&lt;/p&gt;&#10;&lt;h2 id="4-checking-without-importing"&gt;4. Checking without importing &lt;a class="anchor" href="#4-checking-without-importing" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You don&amp;rsquo;t want to &lt;em&gt;import&lt;/em&gt; &lt;code&gt;torch&lt;/code&gt; just to check if it&amp;rsquo;s available—that takes seconds and loads hundreds of megabytes into memory.&#10;Instead, I use &lt;code&gt;importlib.util.find_spec&lt;/code&gt;, which checks whether a module exists on the import path without executing any of its code.&#10;No heavy imports, no GPU initialization, no side effects.&#10;The check is essentially free.&lt;/p&gt;&#10;&lt;h2 id="5-the-metadata-bridge"&gt;5. The metadata bridge &lt;a class="anchor" href="#5-the-metadata-bridge" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;There&amp;rsquo;s a gap between what &lt;code&gt;pyproject.toml&lt;/code&gt; knows and what the runtime check needs.&#10;&lt;code&gt;pyproject.toml&lt;/code&gt; says the &lt;code&gt;rag&lt;/code&gt; extra requires &lt;code&gt;chromadb&amp;gt;=0.4.22&lt;/code&gt;—that&amp;rsquo;s the &lt;em&gt;pip package name&lt;/em&gt;.&#10;But at runtime, I need to check &lt;em&gt;Python import names&lt;/em&gt;.&#10;Sometimes these are the same (&lt;code&gt;chromadb&lt;/code&gt; → &lt;code&gt;import chromadb&lt;/code&gt;), but often they&amp;rsquo;re not: &lt;code&gt;pydantic-ai-slim&lt;/code&gt; is imported as &lt;code&gt;pydantic_ai&lt;/code&gt;, &lt;code&gt;piper-tts&lt;/code&gt; as &lt;code&gt;piper&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;To bridge this, I generate an &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/_extras.json" target="_blank" rel="noopener"&gt;&lt;code&gt;_extras.json&lt;/code&gt;&lt;/a&gt; file that maps each extra to its description and the Python import names needed for the runtime check:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-json" data-lang="json"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;audio&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Audio recording/playback&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;sounddevice&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;rag&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;RAG proxy (ChromaDB, embeddings)&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;chromadb&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pydantic_ai&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;memory&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Long-term memory proxy&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;chromadb&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;yaml&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pydantic_ai&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;vad&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Voice Activity Detection (Silero VAD via ONNX)&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;onnxruntime&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]],&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nt"&gt;&amp;#34;faster-whisper&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Whisper ASR via CTranslate2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;faster_whisper&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This file is &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/.github/scripts/sync_extras.py" target="_blank" rel="noopener"&gt;generated by a script&lt;/a&gt; that parses &lt;code&gt;pyproject.toml&lt;/code&gt; and applies a mapping table for the package-name-to-import-name conversions.&#10;A pre-commit hook ensures it stays in sync—if you add an extra to &lt;code&gt;pyproject.toml&lt;/code&gt; and forget to update the metadata, the commit fails.&lt;/p&gt;&#10;&lt;p&gt;I wish Python packaging had a standard way to discover a package&amp;rsquo;s top-level import name from its distribution name.&#10;It doesn&amp;rsquo;t, so the mapping table is the least-bad option I found.&lt;/p&gt;&#10;&lt;h2 id="6-three-environments-three-strategies"&gt;6. Three environments, three strategies &lt;a class="anchor" href="#6-three-environments-three-strategies" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The hard part is that people run &lt;code&gt;agent-cli&lt;/code&gt; in several different ways, and each needs a different installation strategy.&lt;/p&gt;&#10;&lt;h3 id="a-uv-tool-install--the-persistent-environment"&gt;A) &lt;code&gt;uv tool install&lt;/code&gt; — the persistent environment &lt;a class="anchor" href="#a-uv-tool-install--the-persistent-environment" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;When installed via &lt;code&gt;uv tool install agent-cli&lt;/code&gt;, the tool lives in a persistent environment under &lt;code&gt;~/.local/share/uv/tools/agent-cli/&lt;/code&gt;.&#10;This environment has a &lt;code&gt;uv-receipt.toml&lt;/code&gt; file that tracks which extras are installed.&lt;/p&gt;&#10;&lt;p&gt;When auto-install triggers, the system reads the current extras from that receipt, merges in the new ones, and reinstalls:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;install_extras_impl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quiet&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_uv_tool_install&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;current_extras&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_get_current_uv_tool_extras&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;new_extras&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;sorted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;current_extras&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;_install_via_uv_tool&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;new_extras&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;quiet&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;quiet&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So if you already had &lt;code&gt;audio&lt;/code&gt; installed and now run a command that needs &lt;code&gt;llm&lt;/code&gt;, it becomes &lt;code&gt;uv tool install agent-cli[audio,llm] --force&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;The key insight: &lt;code&gt;uv tool upgrade&lt;/code&gt; reads &lt;code&gt;uv-receipt.toml&lt;/code&gt; and preserves the extras list.&#10;Once auto-install adds an extra, it persists across future upgrades.&#10;You never have to install it again.&lt;/p&gt;&#10;&lt;p&gt;(&lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py#L179-L235" target="_blank" rel="noopener"&gt;Full implementation&lt;/a&gt;)&lt;/p&gt;&#10;&lt;h3 id="b-uvx--the-ephemeral-environment"&gt;B) &lt;code&gt;uvx&lt;/code&gt; — the ephemeral environment &lt;a class="anchor" href="#b-uvx--the-ephemeral-environment" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;&lt;code&gt;uvx&lt;/code&gt; is uv&amp;rsquo;s tool for running packages in temporary, disposable environments.&#10;Running &lt;code&gt;uvx agent-cli transcribe&lt;/code&gt; creates a fresh environment, installs &lt;code&gt;agent-cli&lt;/code&gt;, runs the command, and throws the environment away.&lt;/p&gt;&#10;&lt;p&gt;The problem: there&amp;rsquo;s nowhere to persist extras.&#10;No &lt;code&gt;uv-receipt.toml&lt;/code&gt; to update, no virtualenv that survives the invocation.&lt;/p&gt;&#10;&lt;p&gt;The solution is one of my favorite tricks in this system: re-execute the entire command with the extras baked into the &lt;code&gt;uvx&lt;/code&gt; invocation itself:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_maybe_reexec_with_uvx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_REEXEC_MARKER&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;_is_uvx_cache&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;uvx_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;which&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;uvx&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;uvx_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;extras_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;,&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;extras&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;uvx_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;--python&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;3.13&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;agent-cli[&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;extras_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;]&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&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;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;_maybe_exec_with_marker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;Re-running with extras: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;extras_str&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So &lt;code&gt;uvx agent-cli transcribe&lt;/code&gt; transparently becomes &lt;code&gt;uvx agent-cli[audio,llm] transcribe&lt;/code&gt;.&#10;The user sees a brief &amp;ldquo;Re-running with extras: audio, llm&amp;rdquo; message, and then the command works.&lt;/p&gt;&#10;&lt;p&gt;Environment detection is straightforward—&lt;code&gt;uvx&lt;/code&gt; environments live under the uv cache directory:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_is_uvx_cache&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;prefix_str&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;as_posix&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/cache/uv/&amp;#34;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;prefix_str&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;/archive-v&amp;#34;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;prefix_str&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(&lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py#L287-L301" target="_blank" rel="noopener"&gt;Full implementation&lt;/a&gt;)&lt;/p&gt;&#10;&lt;h3 id="c-regular-virtualenv-pipx-or-system-install"&gt;C) Regular virtualenv, &lt;code&gt;pipx&lt;/code&gt;, or system install &lt;a class="anchor" href="#c-regular-virtualenv-pipx-or-system-install" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;For plain &lt;code&gt;pip install agent-cli&lt;/code&gt;, &lt;code&gt;pipx&lt;/code&gt;, or virtualenv installs, the system falls back to direct installation.&#10;Each extra has a pre-generated requirements file with pinned versions (e.g., &lt;code&gt;_requirements/audio.txt&lt;/code&gt;), and the install command adapts to whatever&amp;rsquo;s available:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_install_cmd&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;in_venv&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;prefix&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;base_prefix&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;shutil&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;which&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;uv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;uv&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pip&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;install&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;--python&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;executable&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;in_venv&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;--system&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;executable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;-m&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pip&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;install&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;in_venv&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;--user&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;cmd&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Prefers &lt;code&gt;uv pip&lt;/code&gt; when available (fast), falls back to regular pip.&#10;Uses &lt;code&gt;--system&lt;/code&gt; or &lt;code&gt;--user&lt;/code&gt; as appropriate when not in a virtualenv.&#10;This is also the path that &lt;code&gt;pipx&lt;/code&gt; installations take—&lt;code&gt;pipx&lt;/code&gt; creates a regular virtualenv under the hood, so the auto-installer detects it as a venv and installs directly into it.&lt;/p&gt;&#10;&lt;p&gt;(&lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py#L215-L248" target="_blank" rel="noopener"&gt;Full implementation&lt;/a&gt;)&lt;/p&gt;&#10;&lt;h2 id="7-preventing-infinite-re-execution-loops"&gt;7. Preventing infinite re-execution loops &lt;a class="anchor" href="#7-preventing-infinite-re-execution-loops" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;There&amp;rsquo;s an obvious footgun here: what if the install succeeds but the package still isn&amp;rsquo;t importable for some reason?&#10;You&amp;rsquo;d get an infinite loop of install → re-exec → check → install → re-exec → &amp;hellip;&lt;/p&gt;&#10;&lt;p&gt;The fix is a simple environment variable marker:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;_REEXEC_MARKER&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;_AGENT_CLI_REEXEC&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_maybe_exec_with_marker&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_REEXEC_MARKER&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="c1"&gt;# Already re-executed once, don&amp;#39;t loop&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;new_env&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;new_env&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;_REEXEC_MARKER&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;1&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execvpe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&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;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;new_env&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;code&gt;os.execvpe&lt;/code&gt; replaces the current process entirely—it never returns.&#10;The marker ensures we only do this once.&#10;If the second run still can&amp;rsquo;t find the packages, it falls back to a helpful error message instead of looping forever.&lt;/p&gt;&#10;&lt;h2 id="8-what-users-actually-see"&gt;8. What users actually see &lt;a class="anchor" href="#8-what-users-actually-see" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;With auto-install &lt;strong&gt;enabled&lt;/strong&gt; (the default), a first run looks like this:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Auto-installing missing extras: audio, llm&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Running: uv tool install agent-cli[audio,llm] --force --python 3.13 -q&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Installation complete!&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Re-running with installed extras...&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And then the command runs normally.&#10;Next time, it runs instantly—no install needed.&lt;/p&gt;&#10;&lt;p&gt;With auto-install &lt;strong&gt;disabled&lt;/strong&gt;, the user gets a clear message telling them exactly what to do:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;This command requires the &amp;#39;audio&amp;#39; extra (Audio recording/playback).&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Install with:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; uv tool install -p 3.13 &amp;#34;agent-cli\[audio]&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # or&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; agent-cli install-extras audio&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If you prefer explicit control, there&amp;rsquo;s also a manual &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/install/extras.py#L24-L104" target="_blank" rel="noopener"&gt;&lt;code&gt;install-extras&lt;/code&gt;&lt;/a&gt; command:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli install-extras rag memory &lt;span class="c1"&gt;# Install specific extras&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli install-extras --all &lt;span class="c1"&gt;# Install everything&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli install-extras --list &lt;span class="c1"&gt;# Show available extras with descriptions&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can opt out via environment variable or config file:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;AGENT_CLI_NO_AUTO_INSTALL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# ~/.config/agent-cli/config.toml&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;settings&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;auto_install_extras&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="9-keeping-everything-in-sync"&gt;9. Keeping everything in sync &lt;a class="anchor" href="#9-keeping-everything-in-sync" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The runtime system depends on two generated artifacts:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;_extras.json&lt;/code&gt;&lt;/strong&gt;: maps extras to descriptions and import names (for the &lt;code&gt;find_spec&lt;/code&gt; check)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;_requirements/*.txt&lt;/code&gt;&lt;/strong&gt;: pinned dependency files for each extra (for the pip/uv install)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;code&gt;_extras.json&lt;/code&gt; is generated by &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/.github/scripts/sync_extras.py" target="_blank" rel="noopener"&gt;&lt;code&gt;sync_extras.py&lt;/code&gt;&lt;/a&gt; (run manually or in CI).&#10;The requirements files are generated by &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/.github/scripts/sync_requirements.py" target="_blank" rel="noopener"&gt;&lt;code&gt;sync_requirements.py&lt;/code&gt;&lt;/a&gt;, which runs as a pre-commit hook whenever &lt;code&gt;pyproject.toml&lt;/code&gt; or &lt;code&gt;uv.lock&lt;/code&gt; changes.&#10;A &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/.github/scripts/check_extras_sync.py" target="_blank" rel="noopener"&gt;check script&lt;/a&gt; enforces that &lt;code&gt;_extras.json&lt;/code&gt; stays consistent with &lt;code&gt;pyproject.toml&lt;/code&gt;—if you add an extra but forget to update the metadata, the commit fails with a clear error.&lt;/p&gt;&#10;&lt;p&gt;This means the runtime system never drifts from the source of truth.&#10;&lt;code&gt;pyproject.toml&lt;/code&gt; is the canonical definition, everything else is derived.&lt;/p&gt;&#10;&lt;h2 id="10-why-uv-made-this-practical"&gt;10. Why uv made this practical &lt;a class="anchor" href="#10-why-uv-made-this-practical" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I want to be clear: this system would be &lt;em&gt;much&lt;/em&gt; harder without &lt;a href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;uv&lt;/a&gt;.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv tool install&lt;/code&gt;&lt;/strong&gt; with persistent extras in &lt;code&gt;uv-receipt.toml&lt;/code&gt;—extras survive upgrades automatically&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;uvx&lt;/code&gt;&lt;/strong&gt; for ephemeral execution with extras specified inline&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv pip install&lt;/code&gt;&lt;/strong&gt; that&amp;rsquo;s fast enough for runtime auto-install to feel acceptable&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;uv export&lt;/code&gt;&lt;/strong&gt; for generating pinned requirements files from &lt;code&gt;uv.lock&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;With traditional pip, auto-installing at runtime would take 30-60 seconds and feel terrible.&#10;With uv, it typically takes a second.&#10;That&amp;rsquo;s the difference between &amp;ldquo;annoying&amp;rdquo; and &amp;ldquo;barely noticeable.&amp;rdquo;&lt;/p&gt;&#10;&lt;h2 id="11-tradeoffs"&gt;11. Tradeoffs &lt;a class="anchor" href="#11-tradeoffs" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This approach works well, but it&amp;rsquo;s still a tradeoff:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;There&amp;rsquo;s metadata to maintain.&lt;/strong&gt; The package-name-to-import-name mapping requires a lookup table with special cases like &lt;code&gt;piper-tts&lt;/code&gt; → &lt;code&gt;piper&lt;/code&gt; and &lt;code&gt;pydantic-ai-slim&lt;/code&gt; → &lt;code&gt;pydantic_ai&lt;/code&gt;. I wish &lt;code&gt;pyproject.toml&lt;/code&gt; had a field for this.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;The check only verifies importability, not version compatibility.&lt;/strong&gt; &lt;code&gt;find_spec&lt;/code&gt; tells you a module exists, not whether it&amp;rsquo;s the right version. In practice this hasn&amp;rsquo;t been a problem because uv&amp;rsquo;s pinned requirements handle versions, but it&amp;rsquo;s a theoretical gap.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Auto-install can fail in restricted environments.&lt;/strong&gt; Corporate machines, read-only containers, air-gapped systems—the opt-out exists for a reason.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Re-exec is a CLI pattern, not a library pattern.&lt;/strong&gt; &lt;code&gt;os.execvpe&lt;/code&gt; replaces the process, which means any shell hooks or signal handlers set up before the decorator runs are lost. Fine for CLI tools, would be problematic for libraries.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="12-not-dependency-injection"&gt;12. Not dependency injection &lt;a class="anchor" href="#12-not-dependency-injection" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I originally called this &amp;ldquo;dependency injection&amp;rdquo; in my head, but that&amp;rsquo;s the wrong term entirely.&#10;Dependency injection is about providing object dependencies through constructors or function parameters.&#10;This is something different.&lt;/p&gt;&#10;&lt;p&gt;The best names I&amp;rsquo;ve come up with:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;runtime optional dependency resolution&lt;/strong&gt; — accurate but a mouthful&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;on-demand extras installation&lt;/strong&gt; — emphasizes the user experience&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;lazy extras&lt;/strong&gt; — short, probably what I&amp;rsquo;d use in conversation&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;If there&amp;rsquo;s a standard term for this pattern, I haven&amp;rsquo;t found it.&lt;/p&gt;&#10;&lt;h2 id="13-conclusion"&gt;13. Conclusion &lt;a class="anchor" href="#13-conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The underlying principle is simple: &lt;strong&gt;the tool should know what it needs, and it should get it&lt;/strong&gt;.&#10;Users shouldn&amp;rsquo;t have to study a matrix of 13 optional extras to figure out which pip command to run.&#10;They should just type the command they want, and it should work.&lt;/p&gt;&#10;&lt;p&gt;uv&amp;rsquo;s speed and tooling model made this practical.&#10;A decorator made it ergonomic for command authors.&#10;Pre-commit hooks made it maintainable.&#10;And three environment-detection strategies made it work regardless of how the user installed the tool.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re building a Python CLI with optional features that keep growing, consider this pattern.&#10;Your users will thank you, mostly by never having to ask &amp;ldquo;which extras do I need?&amp;rdquo;&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;&lt;em&gt;The code discussed here is part of &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt;, an open-source suite of AI-powered command-line tools.&#10;The implementation lives primarily in &lt;a href="https://github.com/basnijholt/agent-cli/blob/c9a67b484331b64733edba8d72d20523699c5a72/agent_cli/core/deps.py" target="_blank" rel="noopener"&gt;&lt;code&gt;agent_cli/core/deps.py&lt;/code&gt;&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#10;</description></item><item><title>Parallel agentic coding made trivial with `agent-cli dev`</title><link>https://www.nijho.lt/post/parallel-agentic-coding/</link><pubDate>Tue, 13 Jan 2026 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/parallel-agentic-coding/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-the-just-use-worktrees-problem"&gt;1. The &amp;ldquo;just use worktrees&amp;rdquo; problem&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-why-parallel-development-matters-for-agentic-coding"&gt;2. Why parallel development matters for agentic coding&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-one-command-to-rule-them-all"&gt;3. One command to rule them all&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-it-knows-your-stack"&gt;4. It knows your stack&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-terminal-magic"&gt;5. Terminal magic&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-spawning-agents-with-prompts"&gt;6. Spawning agents with prompts&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-teaching-claude-to-spawn-agents"&gt;7. Teaching Claude to spawn agents&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-my-actual-workflow"&gt;8. My actual workflow&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-managing-environments"&gt;9. Managing environments&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#10-getting-started"&gt;10. Getting started&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#links"&gt;Links&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-the-just-use-worktrees-problem"&gt;1. The &amp;ldquo;just use worktrees&amp;rdquo; problem &lt;a class="anchor" href="#1-the-just-use-worktrees-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Last week, I was chatting with a friend about my &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;agentic coding workflow&lt;/a&gt;.&#10;I was sharing some of my best practices, and when the topic of parallel development came up, I said:&lt;/p&gt;&#10;&lt;p&gt;&amp;ldquo;Just use git worktrees with quickly installable environments.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;He stared at me blankly.&lt;/p&gt;&#10;&lt;p&gt;And then it hit me: for most developers who just &lt;code&gt;git add&lt;/code&gt;, &lt;code&gt;git commit&lt;/code&gt;, &lt;code&gt;git push&lt;/code&gt; and don&amp;rsquo;t touch their environment setup once it works, this is &lt;em&gt;not&lt;/em&gt; trivial.&#10;What seems obvious to me involves:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Understanding what git worktrees even are&lt;/li&gt;&#10;&lt;li&gt;Knowing the &lt;code&gt;git worktree add&lt;/code&gt; command and its flags&lt;/li&gt;&#10;&lt;li&gt;Remembering to fetch before creating&lt;/li&gt;&#10;&lt;li&gt;Creating a sibling directory structure&lt;/li&gt;&#10;&lt;li&gt;Running your package manager&amp;rsquo;s install command&lt;/li&gt;&#10;&lt;li&gt;Copying over &lt;code&gt;.env&lt;/code&gt; files&lt;/li&gt;&#10;&lt;li&gt;Setting up direnv or manually activating your virtual environment&lt;/li&gt;&#10;&lt;li&gt;Opening a new terminal tab&lt;/li&gt;&#10;&lt;li&gt;Navigating to the worktree&lt;/li&gt;&#10;&lt;li&gt;Finally launching your coding agent&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;That&amp;rsquo;s a lot of friction for something you want to do &lt;em&gt;frequently&lt;/em&gt; when using agentic tools.&lt;/p&gt;&#10;&lt;p&gt;So I built &lt;code&gt;agent-cli dev&lt;/code&gt;.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; &lt;code&gt;agent-cli dev new --agent --prompt &amp;quot;Fix the login bug&amp;quot;&lt;/code&gt; creates a complete, isolated development environment in one command.&#10;It creates a git worktree, installs dependencies, copies env files, sets up direnv, and opens your AI coding agent in a new terminal tab with your prompt already loaded—all automatically.&#10;No more manual setup, no more excuses to not work in parallel.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="2-why-parallel-development-matters-for-agentic-coding"&gt;2. Why parallel development matters for agentic coding &lt;a class="anchor" href="#2-why-parallel-development-matters-for-agentic-coding" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In my &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;previous post on agentic coding&lt;/a&gt;, I described my workflow of running 5-6 Claude Code sessions simultaneously, each working on a different feature.&#10;This is how I can easily work on multiple features in parallel while waiting for an agent to process and generate code.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The usual way:&lt;/strong&gt;&#10;Start feature A → wait for Claude to finish → review → move to feature B → repeat.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The better way:&lt;/strong&gt;&#10;Start feature A in tab 1 → switch to tab 2, start feature B while A is working → switch to tab 3, start feature C → circle back to tab 1, review what Claude did → give feedback, move to next tab → repeat every 10-15 minutes.&lt;/p&gt;&#10;&lt;p&gt;This parallel approach allows me to go much faster.&#10;But it only works if each tab has its own &lt;strong&gt;completely isolated and working environment&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;That&amp;rsquo;s where &lt;a href="https://www.nijho.lt/post/git-worktree/"&gt;git worktrees&lt;/a&gt; come in.&#10;A worktree gives you a separate working directory for a branch, sharing the same git history but with independent file states.&lt;/p&gt;&#10;&lt;p&gt;The problem is the &lt;em&gt;setup&lt;/em&gt;.&#10;Every time you want to start a new feature:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# The manual way (don&amp;#39;t do this)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git fetch origin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add ../my-project-worktrees/cool-feature -b cool-feature origin/main&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ../my-project-worktrees/cool-feature&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uv sync --all-extras &lt;span class="c1"&gt;# or npm install, or poetry install, or...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cp ../.env .env&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Now open a new terminal tab...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Navigate there...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Finally start claude&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After the 100th(?) time doing this manually, I knew I needed to automate it.&lt;/p&gt;&#10;&lt;h2 id="3-one-command-to-rule-them-all"&gt;3. One command to rule them all &lt;a class="anchor" href="#3-one-command-to-rule-them-all" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s what I built:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new --agent&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it.&#10;One command.&#10;Here&amp;rsquo;s what it looks like:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Generated branch name: cool-crane&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Creating worktree &lt;span class="k"&gt;for&lt;/span&gt; branch &lt;span class="s1"&gt;&amp;#39;cool-crane&amp;#39;&lt;/span&gt;...&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Running: git fetch origin&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Running: git worktree add -b cool-crane ~/Work/project-worktrees/cool-crane origin/main&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;✓ Created worktree at ~/Work/project-worktrees/cool-crane&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;✓ Copied env file&lt;span class="o"&gt;(&lt;/span&gt;s&lt;span class="o"&gt;)&lt;/span&gt;: .env.example, .envrc&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Detected Python project with uv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Running: uv sync --all-extras&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;→ Running: direnv allow&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;✓ direnv: allowed existing .envrc&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;✓ Started claude in new iterm2 tab&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;╭─────────────────────────────────────────────── Success ───────────────────────────────────────────────╮&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Dev environment created: ~/Work/project-worktrees/cool-crane │&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;│ Branch: cool-crane │&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;╰───────────────────────────────────────────────────────────────────────────────────────────────────────╯&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;4 seconds later, I have a new terminal tab with Claude Code already running in a fresh, isolated environment.&#10;Ready to work on my next feature.&lt;/p&gt;&#10;&lt;p&gt;What happens under the hood:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Generates a random branch name&lt;/strong&gt; like &lt;code&gt;clever-fox&lt;/code&gt; (you can just set the name yourself of course)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Creates the git worktree&lt;/strong&gt; in a sibling directory&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Detects the project type&lt;/strong&gt; and runs the appropriate setup (&lt;code&gt;uv sync&lt;/code&gt;, &lt;code&gt;npm install&lt;/code&gt;, etc.)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Copies &lt;code&gt;.env&lt;/code&gt; files&lt;/strong&gt; from the main repo&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Sets up direnv&lt;/strong&gt; so the environment activates automatically&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Opens a new terminal tab&lt;/strong&gt; (works with tmux, zellij, iTerm2, and more)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Launches your coding agent&lt;/strong&gt; in that tab&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The Docker-style random names (&lt;code&gt;clever-fox&lt;/code&gt;, &lt;code&gt;happy-bear&lt;/code&gt;, &lt;code&gt;swift-owl&lt;/code&gt;) there just for those too lazy to pick a name.&#10;Just &lt;code&gt;agent-cli dev new --agent&lt;/code&gt; and start coding.&lt;/p&gt;&#10;&lt;h2 id="4-it-knows-your-stack"&gt;4. It knows your stack &lt;a class="anchor" href="#4-it-knows-your-stack" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The command auto-detects your project type:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;If it sees&amp;hellip;&lt;/th&gt;&#10;&lt;th&gt;It runs&amp;hellip;&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;uv.lock&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;uv sync --all-extras&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;pixi.lock&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;pixi install&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;poetry.lock&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;poetry install&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;requirements.yaml&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;unidep install -e .&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;package-lock.json&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;npm install&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;Cargo.toml&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;cargo build&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;code&gt;go.mod&lt;/code&gt;&lt;/td&gt;&#10;&lt;td&gt;&lt;code&gt;go mod download&lt;/code&gt;&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;For my projects using &lt;a href="https://github.com/basnijholt/unidep" target="_blank" rel="noopener"&gt;unidep&lt;/a&gt;, it even detects monorepos and adjusts the command accordingly.&lt;/p&gt;&#10;&lt;p&gt;It also generates the right &lt;code&gt;.envrc&lt;/code&gt; for &lt;a href="https://direnv.net/" target="_blank" rel="noopener"&gt;direnv&lt;/a&gt;.&#10;For a Python project with uv, that&amp;rsquo;s &lt;code&gt;source .venv/bin/activate&lt;/code&gt;.&#10;For a conda/unidep project, it&amp;rsquo;s the full micromamba activation.&#10;For Nix projects, it&amp;rsquo;s &lt;code&gt;use flake&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;This means when you &lt;code&gt;cd&lt;/code&gt; into the worktree later, your environment is automatically activated.&#10;No more &lt;code&gt;source .venv/bin/activate&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="5-terminal-magic"&gt;5. Terminal magic &lt;a class="anchor" href="#5-terminal-magic" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The real magic is opening a new terminal tab with the agent already running.&lt;/p&gt;&#10;&lt;p&gt;The command detects which terminal you&amp;rsquo;re in and uses the appropriate API—whether that&amp;rsquo;s iTerm2, Kitty, Warp, or GNOME Terminal.&#10;It even works with terminal multiplexers like &lt;strong&gt;tmux&lt;/strong&gt; and &lt;strong&gt;zellij&lt;/strong&gt; (my current favorite), opening a new window/tab in your existing session.&lt;/p&gt;&#10;&lt;h2 id="6-spawning-agents-with-prompts"&gt;6. Spawning agents with prompts &lt;a class="anchor" href="#6-spawning-agents-with-prompts" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;code&gt;--prompt&lt;/code&gt; option transforms how I spawn parallel agents.&#10;Instead of just opening a blank Claude session, I can give the new agent its task immediately:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new fix-auth-bug --agent --prompt &lt;span class="s2"&gt;&amp;#34;Fix the login validation bug in auth.py. The issue is that empty passwords pass validation.&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The agent opens with the prompt already loaded and starts working immediately.&#10;No copy-pasting, no context switching, no &amp;ldquo;let me explain what I need you to do.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;For longer, more detailed prompts (which you should use for complex tasks), there&amp;rsquo;s &lt;code&gt;--prompt-file&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new new-feature --agent --prompt-file .claude/spawn-prompt.md&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is particularly powerful when you&amp;rsquo;re in a Claude session and discover a feature that needs work but is unrelated to your current task.&#10;Instead of context-switching or noting it for later, you can spawn a new agent right there:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Write a detailed prompt to a file (Claude can do this)&lt;/li&gt;&#10;&lt;li&gt;Run &lt;code&gt;agent-cli dev new unrelated-feature --agent --prompt-file .claude/spawn-prompt.md&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;A new terminal tab opens with a fresh Claude session already working on the task&lt;/li&gt;&#10;&lt;li&gt;Continue with your original work&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The spawned agent works independently in its own branch while you stay focused.&lt;/p&gt;&#10;&lt;h2 id="7-teaching-claude-to-spawn-agents"&gt;7. Teaching Claude to spawn agents &lt;a class="anchor" href="#7-teaching-claude-to-spawn-agents" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s where it gets really interesting: you can teach Claude Code itself how to spawn parallel agents.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev install-skill&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This installs a &lt;a href="https://docs.anthropic.com/en/docs/claude-code/skills" target="_blank" rel="noopener"&gt;Claude Code skill&lt;/a&gt; that teaches Claude how to use &lt;code&gt;agent-cli dev&lt;/code&gt;.&#10;The skill includes detailed examples and prompt templates following Anthropic&amp;rsquo;s &lt;a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview" target="_blank" rel="noopener"&gt;prompt engineering guide&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;With the skill installed, you can say things like:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&amp;ldquo;Work on auth, payments, and notifications in parallel&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;This feature is unrelated to what we&amp;rsquo;re doing—spawn a new agent for it&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;Split this refactoring by module and work on them simultaneously&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Claude will write well-structured prompts (using proper XML tags, clear context, explicit requirements) and spawn the agents for you.&#10;Each spawned agent writes a report to &lt;code&gt;.claude/REPORT.md&lt;/code&gt; when done, so you can easily review what happened.&lt;/p&gt;&#10;&lt;p&gt;One of my favorite patterns: I ask Claude to look at the latest 10 open GitHub issues and spawn an agent for each one.&#10;Ten independent parallel environments, set up in seconds, each working on a different issue.&#10;That&amp;rsquo;s the kind of leverage this enables.&lt;/p&gt;&#10;&lt;h2 id="8-my-actual-workflow"&gt;8. My actual workflow &lt;a class="anchor" href="#8-my-actual-workflow" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s how I use this in practice.&#10;I&amp;rsquo;m working on &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;agent-cli&lt;/a&gt; itself, and I want to add three features:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Tab 1: New RAG feature&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new rag-improvements --agent --prompt &lt;span class="s2"&gt;&amp;#34;Improve RAG chunking strategy for better retrieval accuracy&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Tab 2: Fix a bug in the transcribe command&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new fix-transcribe-vad --agent --prompt &lt;span class="s2"&gt;&amp;#34;Fix VAD detection cutting off words at sentence boundaries&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Tab 3: Refactor the config system&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new config-refactor --agent --prompt &lt;span class="s2"&gt;&amp;#34;Refactor config.py to use a single Config class with lazy loading&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Three commands, three isolated environments, three Claude Code sessions already working on their tasks.&lt;/p&gt;&#10;&lt;p&gt;I cycle through the tabs every 10-15 minutes:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Review what Claude did&lt;/li&gt;&#10;&lt;li&gt;Give voice feedback using my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;transcription workflow&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;Move to the next tab&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;When a feature is done, I have Claude open a PR from that branch.&#10;When the PR is merged:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev clean --merged&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This uses the GitHub CLI to check which branches have merged PRs, then removes those worktrees and deletes the branches.&#10;No more zombie worktrees cluttering my disk.&lt;/p&gt;&#10;&lt;h2 id="9-managing-environments"&gt;9. Managing environments &lt;a class="anchor" href="#9-managing-environments" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A few other commands I use regularly:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# List all worktrees&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev list&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Navigate to a worktree&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;agent-cli dev path clever-fox&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Remove a worktree&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev rm clever-fox&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Force removal + delete branch&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev rm clever-fox --force --delete-branch&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Check what&amp;#39;s available on your system&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev doctor&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;doctor&lt;/code&gt; command is handy for seeing which terminals, editors, and coding agents are installed and detected.&lt;/p&gt;&#10;&lt;h2 id="10-getting-started"&gt;10. Getting started &lt;a class="anchor" href="#10-getting-started" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;code&gt;agent-cli dev&lt;/code&gt; is part of the &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;agent-cli&lt;/a&gt; package:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# With uv (recommended)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uv tool install agent-cli&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then in any git repository:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Check what&amp;#39;s available&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev doctor&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Create your first parallel environment with a task&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev new my-feature --agent --prompt &lt;span class="s2"&gt;&amp;#34;Add user profile page with avatar upload&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Or install the skill so Claude can spawn agents for you&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;agent-cli dev install-skill&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Supported coding agents:&lt;/strong&gt; Claude Code, Codex, Gemini, Aider, GitHub Copilot, Continue, OpenCode, and Cursor Agent.&#10;Use &lt;code&gt;--with-agent gemini&lt;/code&gt; to pick a specific one, or set a default in your config.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Supported terminals:&lt;/strong&gt; tmux, zellij, iTerm2, Terminal.app, Kitty, Warp, and GNOME Terminal.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Supported editors:&lt;/strong&gt; Cursor, VS Code, Zed, PyCharm (and other JetBrains IDEs), Neovim, Vim, Emacs, Sublime Text, and nano.&lt;/p&gt;&#10;&lt;h2 id="conclusion"&gt;Conclusion &lt;a class="anchor" href="#conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The barrier between &amp;ldquo;I want to work on this feature&amp;rdquo; and &amp;ldquo;I&amp;rsquo;m actually working on it in an isolated environment&amp;rdquo; should be zero.&lt;/p&gt;&#10;&lt;p&gt;Before:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;2-5 minutes of manual setup per feature&lt;/li&gt;&#10;&lt;li&gt;Often skipped because &amp;ldquo;it&amp;rsquo;s not worth it for a small change&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;Mental overhead remembering all the steps&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;After:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;One command, few seconds&lt;/li&gt;&#10;&lt;li&gt;No excuse not to work in isolation&lt;/li&gt;&#10;&lt;li&gt;More parallel features, faster iteration&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;If you&amp;rsquo;re using agentic coding tools and not yet working in parallel, you&amp;rsquo;re leaving productivity on the table.&#10;And if the setup friction was stopping you—well, now it&amp;rsquo;s gone.&lt;/p&gt;&#10;&lt;p&gt;Try it out and let me know what you think!&#10;The code is open-source at &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;github.com/basnijholt/agent-cli&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="links"&gt;Links &lt;a class="anchor" href="#links" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;agent-cli on GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://agent-cli.nijho.lt/commands/dev/" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli dev&lt;/code&gt; documentation&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://docs.anthropic.com/en/docs/claude-code/skills" target="_blank" rel="noopener"&gt;Claude Code skills&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview" target="_blank" rel="noopener"&gt;Anthropic prompt engineering guide&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/git-worktree/"&gt;My post on git worktrees&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;My post on agentic coding&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://zellij.dev/" target="_blank" rel="noopener"&gt;Zellij&lt;/a&gt; / &lt;a href="https://github.com/tmux/tmux" target="_blank" rel="noopener"&gt;tmux&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://direnv.net/" target="_blank" rel="noopener"&gt;direnv&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>SOTA RAG &amp; Memory without the database: Files, Git, and simple folders</title><link>https://www.nijho.lt/post/file-based-rag-memory/</link><pubDate>Wed, 10 Dec 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/file-based-rag-memory/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-the-amnesia-problem"&gt;1. The amnesia problem&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-learning-from-failure-ai-journal"&gt;2. Learning from failure: AI Journal&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-how-i-studied-sota-clone-read-re-implement"&gt;3. How I studied SOTA: clone, read, re-implement&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-the-dependency-problem-why-onnx-over-pytorch"&gt;4. The dependency problem: why ONNX over PyTorch&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-rag-just-let-me-grep-it-kind-of"&gt;5. RAG: just let me grep it (kind of)&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-architecture-openai-compatibility"&gt;The architecture: OpenAI compatibility&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#two-stage-retrieval-the-sota-approach"&gt;Two-stage retrieval: the SOTA approach&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-memory-files-over-databases"&gt;6. Memory: files over databases&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#git-integration-versioning-memory-"&gt;Git integration: versioning memory 🕰️&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-reconciliation-loop"&gt;The reconciliation loop&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-tiny-detail-that-broke-everything"&gt;The tiny detail that broke everything&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-why-building-this-was-necessary"&gt;7. Why building this was necessary&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#privacy"&gt;Privacy&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#integration"&gt;Integration&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#dependencies"&gt;Dependencies&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-try-it-yourself"&gt;8. Try it yourself&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#try-memory"&gt;Try Memory&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#try-rag"&gt;Try RAG&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-what-i-learned"&gt;9. What I learned&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-the-amnesia-problem"&gt;1. The amnesia problem &lt;a class="anchor" href="#1-the-amnesia-problem" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;If you&amp;rsquo;ve read my posts on &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;agentic coding&lt;/a&gt; or my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local AI journey&lt;/a&gt;, you know I am all-in on using AI to control my computer and write software.&#10;But one critical piece was missing: &lt;strong&gt;Context&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;LLMs are powerful but stateless.&#10;Every time I start a new chat, the model forgets who I am, what I&amp;rsquo;m working on, and that I prefer &lt;a href="https://www.nijho.lt/post/functional-python/"&gt;functional Python code&lt;/a&gt; over object-oriented styles.&#10;Worse, it also forgets the thing I just told it five minutes ago in another window.&lt;/p&gt;&#10;&lt;p&gt;The standard solution to this is &lt;a href="https://en.wikipedia.org/wiki/Retrieval-augmented_generation" target="_blank" rel="noopener"&gt;RAG (Retrieval-Augmented Generation)&lt;/a&gt; and &lt;a href="https://arxiv.org/abs/2310.08560" target="_blank" rel="noopener"&gt;Memory&lt;/a&gt;.&#10;But when I looked at the available tools, I hit a wall.&lt;/p&gt;&#10;&lt;p&gt;Most solutions fell into two buckets:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;SaaS / Web UIs:&lt;/strong&gt; Upload your files to a cloud service or use a specific web chat interface that locks you in.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Developer Libraries:&lt;/strong&gt; &amp;ldquo;Just use LangChain/LlamaIndex!&amp;rdquo; they say. Great, now I have to write a Python script every time I want to ask a question about a PDF?&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t want a library. I didn&amp;rsquo;t want a web UI.&#10;&lt;strong&gt;I wanted a folder.&lt;/strong&gt;&#10;I wanted to drop a file into &lt;code&gt;~/my-docs&lt;/code&gt;, and have my AI instantly know about it.&#10;And I wanted my AI&amp;rsquo;s &amp;ldquo;memory&amp;rdquo; to be a file I can edit, not a hidden vector in a database I can&amp;rsquo;t inspect.&lt;/p&gt;&#10;&lt;p&gt;So I decided to build my own file-based solution.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I built &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; features that combine two ideas:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;File-based storage:&lt;/strong&gt; Documents in a folder, memories as Markdown files with Git versioning.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;OpenAI-compatible proxy:&lt;/strong&gt; Works with &lt;em&gt;any&lt;/em&gt; OpenAI-compatible tool—Cursor, Cline, Open WebUI, LibreChat, Lobe Chat, your terminal—without lock-in.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Tools like Open WebUI have built-in RAG, but that forces you to use only Open WebUI.&#10;My proxy means I can switch tools whenever I want, and they all share the same memory and document index.&lt;/p&gt;&#10;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="2-learning-from-failure-ai-journal"&gt;2. Learning from failure: AI Journal &lt;a class="anchor" href="#2-learning-from-failure-ai-journal" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t my first attempt at building a memory system.&lt;/p&gt;&#10;&lt;p&gt;A few months ago, I built &lt;a href="https://github.com/basnijholt/aijournal" target="_blank" rel="noopener"&gt;&lt;strong&gt;AI Journal&lt;/strong&gt;&lt;/a&gt;—an ambitious local-first journaling app where an AI would read your entries and build a &amp;ldquo;living self-model&amp;rdquo; of who you are.&#10;It had sophisticated features: a structured &amp;ldquo;persona core,&amp;rdquo; typed &amp;ldquo;claim atoms&amp;rdquo; with evidence links, four organizational layers (L1→L4), recency-aware scoring with decay functions, and Git-based time travel to &amp;ldquo;ask questions of your younger self.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;The architecture seemed solid.&#10;The problem was simpler: &lt;strong&gt;local models aren&amp;rsquo;t good enough yet.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;I designed the whole thing to run entirely on Ollama with my dual RTX 3090s.&#10;But even with a 48GB of VRAM, the models couldn&amp;rsquo;t reliably extract structured claims, handle the multi-step reconciliation, or maintain coherence across long conversations.&#10;Whether the design was right, I still don&amp;rsquo;t know—but the execution definitely hit the wall of current local LLM capabilities.&lt;/p&gt;&#10;&lt;p&gt;The lesson: I tried to build the entire system at once without validating the core concepts and individual ideas first.&#10;This time, I took a different approach: &lt;strong&gt;tackle it problem by problem.&lt;/strong&gt;&#10;Instead of designing a complete system upfront, I would validate each piece—chunking, retrieval, re-ranking, memory reconciliation—before combining them.&#10;The experience and UX would be my own, but the algorithms would be adapted from established projects.&lt;/p&gt;&#10;&lt;h2 id="3-how-i-studied-sota-clone-read-re-implement"&gt;3. How I studied SOTA: clone, read, re-implement &lt;a class="anchor" href="#3-how-i-studied-sota-clone-read-re-implement" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My approach was more methodical this time.&#10;I cloned five major frameworks into the same workspace as &lt;code&gt;agent-cli&lt;/code&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/run-llama/llama_index" target="_blank" rel="noopener"&gt;LlamaIndex&lt;/a&gt;&lt;/strong&gt;: The OG RAG framework&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/langchain-ai/langchain" target="_blank" rel="noopener"&gt;LangChain&lt;/a&gt;&lt;/strong&gt;: The kitchen-sink approach&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/letta-ai/letta" target="_blank" rel="noopener"&gt;Letta&lt;/a&gt;&lt;/strong&gt; (formerly MemGPT): Stateful agents with long-term memory&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/mem0ai/mem0" target="_blank" rel="noopener"&gt;Mem0&lt;/a&gt;&lt;/strong&gt;: Focused specifically on memory extraction&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/pydantic/pydantic-ai" target="_blank" rel="noopener"&gt;PydanticAI&lt;/a&gt;&lt;/strong&gt;: Clean, typed agent framework&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t read through all this code myself—that would take months.&#10;Instead, I used AI coding agents to search the codebases and write summaries of the technical implementation details:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Gemini CLI&lt;/strong&gt; (Gemini 3.0 Pro)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude Code&lt;/strong&gt; (Opus 4.5)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Codex CLI&lt;/strong&gt; (GPT-5.1-Codex-Max)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I fed those summaries into &lt;strong&gt;ChatGPT 5 Pro&lt;/strong&gt; together with my high level plan of what I wanted to create, and it created an implementation plan.&#10;Then I took that plan back to the coding agents for implementation.&#10;I personally found Opus 4.5 the best coding model, but GPT‑5.1 Codex Max was the best at reviewing the code and actually identifying critical bugs.&lt;/p&gt;&#10;&lt;p&gt;For validation, I used &lt;a href="https://github.com/basnijholt/clip-files" target="_blank" rel="noopener"&gt;&lt;code&gt;clip-files&lt;/code&gt;&lt;/a&gt; to copy the agent-cli source code plus the architecture documents (like &lt;a href="https://github.com/basnijholt/agent-cli/blob/main/docs/architecture/memory.md" target="_blank" rel="noopener"&gt;memory.md&lt;/a&gt; and &lt;a href="https://github.com/basnijholt/agent-cli/blob/main/docs/architecture/rag.md" target="_blank" rel="noopener"&gt;rag.md&lt;/a&gt;) into ChatGPT 5 Pro to validate the approach.&lt;/p&gt;&#10;&lt;p&gt;The AI did the searching and implementing; I did the understanding and decision-making.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;The key insight:&lt;/strong&gt; Existing frameworks are incredibly over-engineered for my use case, but the &lt;em&gt;core algorithms&lt;/em&gt; are gold.&#10;My job was to extract the essence and re-implement it cleanly.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="4-the-dependency-problem-why-onnx-over-pytorch"&gt;4. The dependency problem: why ONNX over PyTorch &lt;a class="anchor" href="#4-the-dependency-problem-why-onnx-over-pytorch" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One thing became immediately clear when going through these frameworks: &lt;strong&gt;they&amp;rsquo;re massive&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Installing LlamaIndex with all its dependencies pulls in PyTorch.&#10;PyTorch alone is &lt;strong&gt;2-3GB&lt;/strong&gt;.&#10;Add transformers, sentence-transformers, and the kitchen sink, and you&amp;rsquo;re looking at an &lt;strong&gt;8GB+ environment&lt;/strong&gt; just to ask questions about some PDFs.&lt;/p&gt;&#10;&lt;p&gt;This felt excessive for a CLI tool.&lt;/p&gt;&#10;&lt;p&gt;One of my core design goals was &lt;strong&gt;minimal dependencies&lt;/strong&gt;.&#10;I wanted &lt;code&gt;agent-cli&lt;/code&gt; to install in seconds, not minutes.&#10;I wanted it to work on my Mac, my NixOS server, and my friend&amp;rsquo;s laptop without downloading half the internet.&lt;/p&gt;&#10;&lt;p&gt;The solution: &lt;strong&gt;ONNX Runtime&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;ONNX Runtime is ~200MB and runs inference on basically anything—CPU, CUDA, even Apple Silicon.&#10;For embeddings, I use &lt;a href="https://developers.googleblog.com/introducing-embeddinggemma/" target="_blank" rel="noopener"&gt;&lt;code&gt;embeddinggemma&lt;/code&gt;&lt;/a&gt; running locally via &lt;a href="https://www.nijho.lt/post/llama-nixos/"&gt;llama.cpp&lt;/a&gt;.&#10;For re-ranking, I use a cross-encoder exported to ONNX (&lt;code&gt;Xenova/ms-marco-MiniLM-L-6-v2&lt;/code&gt;).&lt;/p&gt;&#10;&lt;p&gt;The result: &lt;code&gt;pip install agent-cli[rag]&lt;/code&gt; takes about 30 seconds and adds ~300MB.&#10;The key insight: embeddings and re-ranking are cheap operations.&#10;You don&amp;rsquo;t need a GPU for them—CPU is perfectly fine.&#10;PyTorch with CUDA support can easily reach 2-3GB+; ONNX Runtime is ~200MB and runs anywhere.&#10;Since I&amp;rsquo;m not training models, just running inference on small encoders, ONNX is the obvious choice.&lt;/p&gt;&#10;&lt;h2 id="5-rag-just-let-me-grep-it-kind-of"&gt;5. RAG: just let me grep it (kind of) &lt;a class="anchor" href="#5-rag-just-let-me-grep-it-kind-of" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My requirement for RAG was simple: &lt;strong&gt;Files on disk are the source of truth.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;I didn&amp;rsquo;t want to manage an ingestion pipeline or trigger APIs.&#10;I implemented a &lt;a href="https://github.com/basnijholt/agent-cli/blob/main/docs/architecture/rag.md" target="_blank" rel="noopener"&gt;RAG proxy&lt;/a&gt; that uses OS-level file watchers (&lt;code&gt;watchfiles&lt;/code&gt;).&#10;Here is the workflow:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;I drop a PDF, Markdown, or Python file into &lt;code&gt;~/rag_docs&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;The system detects the &lt;code&gt;Create&lt;/code&gt; event.&lt;/li&gt;&#10;&lt;li&gt;It chunks the text and embeds it into a local ChromaDB instance.&lt;/li&gt;&#10;&lt;li&gt;It&amp;rsquo;s immediately searchable.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;When moving or deleting files, the system updates the index accordingly.&lt;/p&gt;&#10;&lt;h3 id="the-architecture-openai-compatibility"&gt;The architecture: OpenAI compatibility &lt;a class="anchor" href="#the-architecture-openai-compatibility" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The &amp;ldquo;secret sauce&amp;rdquo; isn&amp;rsquo;t the retrieval itself; it&amp;rsquo;s how I expose it.&#10;Instead of building a custom chat app, I built an &lt;strong&gt;OpenAI-compatible proxy&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;div class="mermaid"&gt;flowchart LR&#10; Client["Client&lt;br/&gt;(Cursor, Open WebUI)"] --&gt; Retrieve&#10;&#10; subgraph Proxy ["RAG Proxy"]&#10; direction TB&#10; Retrieve --&gt; Augment["Augment &amp; Forward"]&#10; Chroma[("ChromaDB")] -.-&gt; Retrieve&#10; Watcher["File Watcher"] --&gt; Chroma&#10; end&#10;&#10; Augment --&gt; Upstream["Upstream LLM"]&lt;/div&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Point any OpenAI-compatible tool at your local proxy&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:8000/v1&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;That&amp;rsquo;s it. Any tool that supports custom OpenAI endpoints—Cursor, Cline, Open WebUI, LibreChat—instantly gains the ability to &amp;ldquo;read&amp;rdquo; my document folder.&lt;/p&gt;&#10;&lt;h3 id="two-stage-retrieval-the-sota-approach"&gt;Two-stage retrieval: the SOTA approach &lt;a class="anchor" href="#two-stage-retrieval-the-sota-approach" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I looked at LlamaIndex here.&#10;Standard &amp;ldquo;semantic search&amp;rdquo; (using just embeddings/bi-encoders) is often disappointing.&#10;It finds text that &lt;em&gt;looks&lt;/em&gt; similar but isn&amp;rsquo;t actually relevant.&lt;/p&gt;&#10;&lt;p&gt;A common pattern in modern RAG systems is &lt;strong&gt;Two-Stage Retrieval&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Fast Stage:&lt;/strong&gt; Retrieve 3x candidates using standard embeddings (&lt;code&gt;text-embedding-3-small&lt;/code&gt; or local models like &lt;a href="https://developers.googleblog.com/introducing-embeddinggemma/" target="_blank" rel="noopener"&gt;&lt;code&gt;embeddinggemma&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Smart Stage:&lt;/strong&gt; Use a &lt;strong&gt;Cross-Encoder&lt;/strong&gt; to re-rank the results.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;A cross-encoder looks at the query and the document &lt;em&gt;together&lt;/em&gt; and outputs a relevance score.&#10;It&amp;rsquo;s computationally heavier, but since I&amp;rsquo;m running this locally on my RTX 3090 (or even CPU via ONNX), the 50ms latency penalty is worth it for results that are actually useful.&lt;/p&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t a new idea, but implementing it cleanly with ONNX avoided the huge dependency tax.&lt;/p&gt;&#10;&lt;h2 id="6-memory-files-over-databases"&gt;6. Memory: files over databases &lt;a class="anchor" href="#6-memory-files-over-databases" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This is where my approach diverges most from standard tools like Mem0.&#10;Most memory systems treat memories as database rows.&#10;If the AI remembers &amp;ldquo;User likes pizza,&amp;rdquo; that&amp;rsquo;s a vector in a DB.&#10;If it hallucinates and records &amp;ldquo;User hates pizza,&amp;rdquo; good luck fixing it.&#10;You need to write a script to query the DB and delete the row.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;I prefer data I can inspect.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;My memory system stores every fact as a &lt;strong&gt;Markdown file&lt;/strong&gt; with YAML front matter.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;550e8400-e29b-41d4-a716-446655440000&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;memory&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;created_at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;2025-12-15T10:00:00Z&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;conversation_id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;default&amp;#34;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nn"&gt;---&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;The user prefers using &amp;#39;uv&amp;#39; for Python package management.&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="git-integration-versioning-memory-"&gt;Git integration: versioning memory 🕰️ &lt;a class="anchor" href="#git-integration-versioning-memory-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Because memories are just files, I added a feature that I haven&amp;rsquo;t seen anywhere else: &lt;strong&gt;Automatic Git Versioning&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Every time the AI learns a new fact, updates an old one, or deletes a contradiction, the system automatically commits the change to a local git repository.&lt;/p&gt;&#10;&lt;p&gt;This leads to incredible capabilities:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Inspectability:&lt;/strong&gt; I can &lt;code&gt;git log&lt;/code&gt; and see exactly &lt;em&gt;when&lt;/em&gt; the AI learned something.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Correction:&lt;/strong&gt; If the AI learns something wrong, I open the markdown file in VS Code, edit it, and save.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reversion:&lt;/strong&gt; Agent hallucinated wildly yesterday? &lt;code&gt;git reset --hard HEAD~1&lt;/code&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="the-reconciliation-loop"&gt;The reconciliation loop &lt;a class="anchor" href="#the-reconciliation-loop" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The logic for storing memories isn&amp;rsquo;t just &amp;ldquo;append to file.&amp;rdquo;&#10;Digging into Mem0 (and Letta) showed me that memory systems need active &lt;strong&gt;reconciliation&lt;/strong&gt;.&#10;When I say &amp;ldquo;Actually, I switched to nix instead of uv,&amp;rdquo; the system:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Retrieves&lt;/strong&gt; existing memories about package managers.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Decides&lt;/strong&gt; (using a lightweight LLM) whether to &lt;code&gt;ADD&lt;/code&gt;, &lt;code&gt;UPDATE&lt;/code&gt;, or &lt;code&gt;DELETE&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Executes&lt;/strong&gt; the file operation (moving the old fact to a &lt;code&gt;deleted/&lt;/code&gt; folder for audit trails).&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This keeps the memory bank clean and contradictory-free, unlike simple vector stores that just accumulate conflicting junk over time.&lt;/p&gt;&#10;&lt;h3 id="the-tiny-detail-that-broke-everything"&gt;The tiny detail that broke everything &lt;a class="anchor" href="#the-tiny-detail-that-broke-everything" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;After implementing the memory system—mostly modeled after Mem0—I noticed it didn&amp;rsquo;t work as well.&#10;After a lot of debugging, I found a tiny difference: I was asking the model for structured data via a tool call, whereas Mem0 uses freeform JSON that the LLM returns directly.&lt;/p&gt;&#10;&lt;p&gt;Since I use PydanticAI, fixing this was a one-line change:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;agent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;model_cfg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;system_prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;UPDATE_MEMORY_PROMPT&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;output_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MemoryDecision&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;output_type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;PromptedOutput&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;MemoryDecision&lt;/span&gt;&lt;span class="p"&gt;]),&lt;/span&gt; &lt;span class="c1"&gt;# JSON mode instead of tool calls&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;retries&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is exactly why reading the source code matters—not just the algorithms, but the tiny details that make them work.&lt;/p&gt;&#10;&lt;h2 id="7-why-building-this-was-necessary"&gt;7. Why building this was necessary &lt;a class="anchor" href="#7-why-building-this-was-necessary" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You might ask: &amp;ldquo;Bas, why write thousands of lines of code for this? Why not just use ChatGPT&amp;rsquo;s memory or install LangChain?&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;Three reasons: &lt;strong&gt;Privacy&lt;/strong&gt;, &lt;strong&gt;Integration&lt;/strong&gt;, and &lt;strong&gt;Dependencies&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;h3 id="privacy"&gt;Privacy &lt;a class="anchor" href="#privacy" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I want to feed my AI my financial records, my health data, and my private journals.&#10;I am not comfortable sending that to OpenAI&amp;rsquo;s long-term storage or some VC-backed startup&amp;rsquo;s vector cloud.&#10;With &lt;code&gt;agent-cli&lt;/code&gt;, the vectors live in &lt;code&gt;~/.cache/agent-cli/chroma&lt;/code&gt;, the files live in &lt;code&gt;~/documents&lt;/code&gt;, and the only thing leaving my machine is the specific context needed for a specific query (if I use a cloud model) or nothing at all (if I use Ollama/&lt;a href="https://www.nijho.lt/post/llama-nixos/"&gt;llama.cpp&lt;/a&gt;).&lt;/p&gt;&#10;&lt;h3 id="integration"&gt;Integration &lt;a class="anchor" href="#integration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;By building this as an API proxy, I solved the &amp;ldquo;fragmented tools&amp;rdquo; problem.&#10;Any tool that supports custom OpenAI-compatible endpoints works out of the box:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;agent-cli chat&lt;/code&gt;&lt;/strong&gt; in the terminal&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Cursor&lt;/strong&gt; or &lt;strong&gt;Cline&lt;/strong&gt; for agentic coding&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://openwebui.com/" target="_blank" rel="noopener"&gt;Open WebUI&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a href="https://www.librechat.ai/" target="_blank" rel="noopener"&gt;LibreChat&lt;/a&gt;&lt;/strong&gt;, or &lt;strong&gt;&lt;a href="https://lobechat.com/" target="_blank" rel="noopener"&gt;Lobe Chat&lt;/a&gt;&lt;/strong&gt; in the browser&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Because my system speaks &amp;ldquo;OpenAI,&amp;rdquo; all of these tools share the &lt;em&gt;same&lt;/em&gt; memory and the &lt;em&gt;same&lt;/em&gt; document index.&#10;If I tell the terminal agent &amp;ldquo;I&amp;rsquo;m working on Project X,&amp;rdquo; and then switch to Cursor, Cursor knows about Project X.&#10;I can try a new chat UI tomorrow without losing anything—just point it to &lt;code&gt;localhost:8000&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h3 id="dependencies"&gt;Dependencies &lt;a class="anchor" href="#dependencies" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;To me, it just doesn&amp;rsquo;t feel right that asking questions about a PDF requires downloading 8GB of PyTorch.&#10;By choosing ONNX Runtime over the PyTorch ecosystem, I kept the entire install lightweight and fast.&#10;This matters when you want to run the system on a cheap VPS or your friend&amp;rsquo;s laptop.&lt;/p&gt;&#10;&lt;h2 id="8-try-it-yourself"&gt;8. Try it yourself &lt;a class="anchor" href="#8-try-it-yourself" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The entire system is open-source and available in &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h3 id="try-memory"&gt;Try Memory &lt;a class="anchor" href="#try-memory" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Get an LLM that remembers you using &lt;a href="https://ollama.com" target="_blank" rel="noopener"&gt;Ollama&lt;/a&gt;.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 1. Pull models and start proxy&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ollama pull embeddinggemma:300m &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; ollama pull gpt-oss:20b&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uvx -p 3.13 --from &lt;span class="s2"&gt;&amp;#34;agent-cli[memory]&amp;#34;&lt;/span&gt; agent-cli memory proxy &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --memory-path ./my-memories &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --openai-base-url http://localhost:11434/v1 &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --embedding-model embeddinggemma:300m&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 2. Chat from the terminal (env vars point to proxy)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:8100/v1 &lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dummy&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Tell it something about yourself&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uvx openai api chat.completions.create -m gpt-oss:20b -g user &lt;span class="s2"&gt;&amp;#34;My name is Alice and I love hiking&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Later, ask if it remembers&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uvx openai api chat.completions.create -m gpt-oss:20b -g user &lt;span class="s2"&gt;&amp;#34;What&amp;#39;s my name?&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="try-rag"&gt;Try RAG &lt;a class="anchor" href="#try-rag" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Chat with your documents.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 1. Start the RAG proxy (runs in foreground)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uvx -p 3.13 --from &lt;span class="s2"&gt;&amp;#34;agent-cli[rag]&amp;#34;&lt;/span&gt; agent-cli rag-proxy &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --docs-folder ./my-docs &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --openai-base-url http://localhost:11434/v1 &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --embedding-model embeddinggemma:300m&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 2. Chat with your docs&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;OPENAI_BASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;http://localhost:8000/v1 &lt;span class="nv"&gt;OPENAI_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;dummy &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; uvx openai api chat.completions.create &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -m gpt-oss:20b &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -g user &lt;span class="s2"&gt;&amp;#34;What does my documentation say about X?&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="9-what-i-learned"&gt;9. What I learned &lt;a class="anchor" href="#9-what-i-learned" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This journey reinforced a few beliefs:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Validate components first.&lt;/strong&gt; AI Journal failed not because the ideas were wrong, but because I tried to build a complete system before validating individual components. This time I tackled problems one at a time—chunking, retrieval, re-ranking, memory reconciliation—and only combined them once each piece worked.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Study implementations, not just papers.&lt;/strong&gt; Reading about two-stage retrieval is one thing. Reading how LlamaIndex actually implements it—the edge cases, the defaults, the performance tradeoffs—is far more valuable. Clone the repos. Read (or make AI read) the code.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Dependencies matter.&lt;/strong&gt; A 30-second install versus a 10-minute download changes whether someone actually tries your tool. I am happy with the ONNX Runtime over PyTorch choice.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Files are the ultimate API.&lt;/strong&gt; By stripping away the complex databases and proprietary interfaces, I ended up with a system that is robust, version-controllable, and surprisingly simple to reason about.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Use the best model for each job.&lt;/strong&gt; I used 4 different AI models during development, each with different strengths. Gemini 3.0 Pro, Opus 4.5, GPT-5.1-Codex Max. I used all of them during the implementation phase, but each one has its own strengths. Fore example, Opus 4.5 was the best coding model, but GPT-5.1 Codex Max was the best at reviewing the code and actually identifying critical bugs (use the built-in &lt;code&gt;/review&lt;/code&gt; feature).&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;</description></item><item><title>I've gone full Nix: Proxmox to NixOS + Incus</title><link>https://www.nijho.lt/post/proxmox-to-nixos/</link><pubDate>Sat, 29 Nov 2025 13:00:00 +0100</pubDate><guid isPermaLink="false">/post/proxmox-to-nixos/</guid><description>&lt;h1 id="ive-gone-full-nix-proxmox-to-nixos--incus"&gt;I&amp;rsquo;ve gone full Nix: Proxmox to NixOS + Incus&lt;/h1&gt;&#10;&lt;p&gt;I have officially decommissioned my Proxmox cluster.&#10;After years of running my homelab on Proxmox, starting with a single NUC and expanding to a multi-node cluster, I have migrated everything to NixOS running Incus.&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Update 2026-06-26:&lt;/strong&gt; This post reached the front page of &lt;a href="https://news.ycombinator.com/item?id=48679385" target="_blank" rel="noopener"&gt;Hacker News&lt;/a&gt;, and several readers correctly pointed out that Proxmox is not limited to clicking around in the web UI.&#10;It has &lt;code&gt;qm&lt;/code&gt;, &lt;code&gt;pct&lt;/code&gt;, config files, a REST API, Terraform providers, and Ansible workflows.&#10;My point is not that Proxmox cannot be automated.&#10;Even with that automation, state drift can still creep in when debugging means running one quick command, especially if an agent is allowed to execute imperative fixes that never make it back into the automation framework.&#10;It is that, for my setup, I wanted the reproducible configuration itself to be the source of truth.&#10;The thing I care about is not buttons versus commands, but whether I can rebuild the host from version-controlled text files and know that every important change is captured there.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;h2 id="from-skeptic-to-believer"&gt;From Skeptic to Believer &lt;a class="anchor" href="#from-skeptic-to-believer" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I wasn&amp;rsquo;t always a Nix evangelist.&#10;In fact, I initially despised the language and its syntax.&#10;I couldn&amp;rsquo;t figure out how it worked, and I already had my own specific way of setting up my dotfiles.&#10;I used &lt;a href="https://www.nijho.lt/post/dotfiles/"&gt;Dotbot&lt;/a&gt; for symlinking and a tool I wrote called &lt;a href="https://www.nijho.lt/post/dotbins/"&gt;dotbins&lt;/a&gt; for managing binaries.&#10;I didn&amp;rsquo;t feel like I required Nix for most of my tools.&#10;I used &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nix-darwin/configuration.nix" target="_blank" rel="noopener"&gt;nix-darwin&lt;/a&gt; on my Mac for a long time, but only to specify Homebrew packages and application settings.&lt;/p&gt;&#10;&lt;p&gt;My true conversion happened when I bought my gaming PC, as described in my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local LLM post&lt;/a&gt;.&#10;I initially installed Pop!_OS because I wanted to play games and absolutely wanted to avoid Windows.&#10;I got some games to work, but I constantly ran into NVIDIA driver issues that required running random, imperative commands to fix.&#10;I felt that was a bad solution because I could never reproduce those debugging steps later.&#10;Then I did the dumb thing of updating my NVIDIA drivers, not realizing that imperatively managing driver versions and repositories is a recipe for disaster, and got stuck in a GRUB boot loop.&#10;Frustrated, I installed NixOS, hoping its promise of atomic updates would solve this.&#10;The result was glorious.&#10;I never really believed that everything would be byte-for-byte equivalent until I migrated that system to a new disk.&#10;I didn&amp;rsquo;t clone the drive; I just applied my Nix configuration to a fresh install.&#10;It booted, I copied my data, and everything was identical.&#10;That was the moment it clicked.&lt;/p&gt;&#10;&lt;h2 id="the-friction-of-imperative-systems"&gt;The Friction of Imperative Systems &lt;a class="anchor" href="#the-friction-of-imperative-systems" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Proxmox is fantastic software.&#10;It lowered the barrier to entry for me and taught me almost everything I know about virtualization, LXC containers, and ZFS.&#10;But fundamentally, Proxmox is built around &lt;strong&gt;clicking buttons&lt;/strong&gt;.&#10;It is a GUI-first paradigm.&#10;While you &lt;em&gt;can&lt;/em&gt; automate it with Terraform or Ansible, it often feels like fighting the tool.&#10;State drift is real.&#10;You change a setting in the UI to debug something, forget about it, and six months later your &amp;ldquo;infrastructure as code&amp;rdquo; is out of sync with reality.&#10;For a human maintaining a system manually, this is annoying.&#10;But when you introduce AI agents, this becomes a disaster for the operator.&#10;An agent running in &amp;ldquo;YOLO mode&amp;rdquo; might execute hundreds of imperative commands to fix a problem.&#10;It might succeed, but it leaves your system in an undefined, unreproducible state that no one—not even the agent—can fully understand or replicate later.&lt;/p&gt;&#10;&lt;p&gt;This friction manifests in hardware management too.&#10;On my HP EliteDesk, the Intel I219-LM network card has a known bug where it hangs with hardware offloading enabled.&#10;I vaguely remembered fixing this years ago on Proxmox, but I had forgotten the details.&#10;When I set up NixOS, I ran into the same issue: the network would randomly drop.&#10;This time, however, the fix isn&amp;rsquo;t a forgotten command run in a root shell history.&#10;It is a &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/hosts/hp/networking.nix#L16-L31" target="_blank" rel="noopener"&gt;documented systemd service&lt;/a&gt; in my configuration.&#10;I added a comment explaining exactly &lt;em&gt;why&lt;/em&gt; &lt;code&gt;tso off gso off&lt;/code&gt; is needed, citing the forum threads.&#10;If I ever reinstall this machine, the fix applies automatically.&#10;On Proxmox, I would have had to rediscover this pain all over again.&lt;/p&gt;&#10;&lt;p&gt;Another example is my Intel NUC.&#10;Since my homelab lives behind my TV, I wondered if I could also use it as a Home Theater PC (HTPC).&#10;On Proxmox, this would have required passing the GPU through to a VM to get video output.&#10;But doing so would mean the Proxmox host loses access to the GPU entirely, meaning no local console if things go wrong.&#10;It was a strict trade-off: either a media player, or a debuggable hypervisor. I tried it, but it was so much trouble that I quickly reverted.&#10;With NixOS, I don&amp;rsquo;t have to choose.&#10;The host OS runs &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/hosts/nuc/kodi.nix" target="_blank" rel="noopener"&gt;Kodi directly&lt;/a&gt;, giving me native hardware acceleration and video output.&#10;Simultaneously, &lt;code&gt;incus&lt;/code&gt; runs in the background, hosting my containers.&#10;I get my HTPC and my server on the same metal, without the virtualization tax or the &amp;ldquo;headless host&amp;rdquo; limitation.&lt;/p&gt;&#10;&lt;p&gt;There is a deeper philosophical difference too.&#10;Systems like Proxmox or TrueNAS are designed as appliances.&#10;You aren&amp;rsquo;t supposed to run arbitrary commands on the host; installing packages or tweaking config files is discouraged because you might break the middleware or lose changes on upgrade.&#10;You are effectively locked out of your own hardware&amp;rsquo;s full potential.&#10;With NixOS, the host is fully mine.&#10;I can mess with it—installing Kodi, tweaking network drivers, running local LLMs—without fear.&#10;Because the state is declarative, it is 100% obvious and reproducible.&#10;I can break the host configuration and recover to a working state in seconds, even if the machine is running essential services.&lt;/p&gt;&#10;&lt;h2 id="the-agentic-multiplier"&gt;The Agentic Multiplier &lt;a class="anchor" href="#the-agentic-multiplier" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I have written before about &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;my shift towards agentic coding&lt;/a&gt;.&#10;In a world where AI agents execute tasks, &lt;strong&gt;CLI-first&lt;/strong&gt; and &lt;strong&gt;declarative&lt;/strong&gt; systems are king.&#10;An AI agent cannot reliably &amp;ldquo;click buttons&amp;rdquo; in a web interface to configure a VLAN tag or resize a disk.&#10;It needs text.&#10;It needs determinism.&lt;/p&gt;&#10;&lt;p&gt;By moving to NixOS, my entire infrastructure is defined in text files.&#10;This means my AI agents can read, understand, and even safely modify my infrastructure.&#10;Proxmox&amp;rsquo;s opaque database and UI-driven workflow were a black box to my agents.&#10;NixOS is an open book.&#10;If I want my agent to &amp;ldquo;deploy a Faster Whisper API server on port 9000 and expose it to the LAN&amp;rdquo;, it doesn&amp;rsquo;t need to navigate a &amp;ldquo;Services&amp;rdquo; menu, then a &amp;ldquo;Network&amp;rdquo; menu, and then a &amp;ldquo;Firewall&amp;rdquo; menu.&#10;It just &lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/pc/ai.nix#L385" target="_blank" rel="noopener"&gt;writes a systemd service definition&lt;/a&gt; and adds &lt;code&gt;networking.firewall.allowedTCPPorts = [ 9000 ];&lt;/code&gt; in the same file.&#10;The agent can even verify the change was successful by checking the git diff or the active configuration.&#10;This is the infrastructure counterpart to the &amp;ldquo;agentic coding&amp;rdquo; revolution I&amp;rsquo;m living in.&lt;/p&gt;&#10;&lt;p&gt;A friend who has used NixOS for many years recently complimented me on how nicely my configuration was structured, especially for managing 8 different machines.&#10;The funny thing is, I haven&amp;rsquo;t written almost a single line of my configuration myself.&#10;I did all of it using agentic AI over many sessions.&#10;I have restructured and refactored it quite a few times, going from a single machine to 2 machines, and eventually to 9.&#10;The AI handles the heavy lifting of refactoring, ensuring that my &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/flake.nix" target="_blank" rel="noopener"&gt;PC, NUC, and HP&lt;/a&gt; all share common modules while keeping their unique personalities.&lt;/p&gt;&#10;&lt;h2 id="the-architecture-incus--simulation"&gt;The Architecture: Incus &amp;amp; Simulation &lt;a class="anchor" href="#the-architecture-incus--simulation" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I still wish there was a purely &amp;ldquo;Nix&amp;rdquo; way to manage persistent, stateful LXC containers and VMs.&#10;There are projects like &lt;code&gt;nixos-containers&lt;/code&gt; or &lt;code&gt;microvm.nix&lt;/code&gt;, but they often lack the operational maturity or live-migration features of a robust hypervisor.&#10;&lt;a href="https://linuxcontainers.org/incus/" target="_blank" rel="noopener"&gt;Incus&lt;/a&gt; (the community fork of LXD) fills this gap perfectly.&#10;It gives me the &amp;ldquo;cattle&amp;rdquo; management of NixOS for the host, while allowing me to run &amp;ldquo;pet&amp;rdquo; legacy workloads (like my old Ubuntu containers or Home Assistant VM) in a stable, manageable environment.&#10;Crucially, Incus is entirely controllable via a clean CLI, making it a perfect citizen in my agentic workflow.&lt;/p&gt;&#10;&lt;p&gt;Over time, I had already migrated most of my legacy LXC containers—services like DNS or media managers—to declarative Docker Compose files running inside VMs.&#10;But I still had one major holdout: &lt;strong&gt;Home Assistant OS&lt;/strong&gt;.&#10;I didn&amp;rsquo;t have a good alternative for it.&#10;I assumed I needed a dedicated appliance OS like Proxmox to run it reliably.&#10;I didn&amp;rsquo;t realize that with Incus on NixOS, running a full VM for Home Assistant is trivial.&#10;It’s just another QEMU process, but managed with the same ease as a container.&lt;/p&gt;&#10;&lt;p&gt;One neat thing I did was create Incus VMs that replicate the exact same configuration as my physical machines.&#10;Before I actually switched off my last Proxmox host, I was already confident that the full configuration worked because I had a virtual machine running the same setup.&#10;I just have a small file with &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/hosts/hp/incus-overrides.nix" target="_blank" rel="noopener"&gt;overrides&lt;/a&gt;.&#10;Then I could validate that the virtual machine worked.&#10;This removed the fear of &amp;ldquo;nuking and paving&amp;rdquo; my physical servers.&lt;/p&gt;&#10;&lt;h2 id="the-migration"&gt;The Migration &lt;a class="anchor" href="#the-migration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Migrating was surprisingly straightforward, thanks to &lt;code&gt;vzdump&lt;/code&gt; and &lt;code&gt;qemu-img&lt;/code&gt;.&#10;Here is how I moved my 7+ years of digital history without losing data.&lt;/p&gt;&#10;&lt;p&gt;I also kept some &lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/archive/PROXMOX_MIGRATION.md" target="_blank" rel="noopener"&gt;detailed migration notes&lt;/a&gt; in my dotfiles.&#10;These notes should be sufficient for anyone trying to do the same.&#10;And if not, giving them to an AI (I used Gemini 3 Pro) will certainly allow you to figure it out.&lt;/p&gt;&#10;&lt;h3 id="1-migrating-lxc-containers"&gt;1. Migrating LXC Containers &lt;a class="anchor" href="#1-migrating-lxc-containers" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;For my LXC containers (running Docker, DNS, etc.), I essentially &amp;ldquo;teleported&amp;rdquo; them.&#10;I dumped the running container on Proxmox to a standardized tarball, copied it over, and streamed it directly into a fresh Incus container.&lt;/p&gt;&#10;&lt;p&gt;On Proxmox:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Dump container 101 to a compressed archive&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vzdump &lt;span class="m"&gt;101&lt;/span&gt; --dumpdir /var/lib/vz/dump --mode &lt;span class="nb"&gt;suspend&lt;/span&gt; --compress zstd&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On NixOS (using my &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/archive/migrate-lxc.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;migrate-lxc.sh&lt;/code&gt;&lt;/a&gt; script):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Stream the backup into a new Incus container&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./migrate-lxc.sh vzdump-lxc-101-*.tar.zst ubuntu-container&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This script creates a fresh container, mounts its root filesystem, and overwrites it with the Proxmox dump.&#10;It handles the messy parts—like mapping UIDs and fixing &lt;code&gt;machine-id&lt;/code&gt;—automatically.&lt;/p&gt;&#10;&lt;h3 id="2-migrating-virtual-machines"&gt;2. Migrating Virtual Machines &lt;a class="anchor" href="#2-migrating-virtual-machines" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;For VMs (like Home Assistant OS), it was a matter of converting the disk format.&#10;Proxmox uses LVM-thin or ZFS zvols; Incus is happy with QCOW2 or raw ZFS.&lt;/p&gt;&#10;&lt;p&gt;On Proxmox:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Export the ZFS volume to a QCOW2 file&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;qemu-img convert -p -O qcow2 /dev/zvol/rpool/data/vm-100-disk-0 vm-100.qcow2&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;On NixOS (using &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/archive/migrate-vm.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;migrate-vm.sh&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Import the disk and create the VM&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./migrate-vm.sh vm-100.qcow2 home-assistant&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="the-result"&gt;The Result &lt;a class="anchor" href="#the-result" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I now manage my entire fleet—Host OS, networking, storage, and hypervisor configuration—from a single git repository.&#10;I get the best of both worlds: persistent, stateful services where I need them, and a reproducible, bulletproof host operating system.&#10;I can wipe my host machine, reinstall NixOS, run a restore script, and be back online in minutes.&#10;Best of all, I never have to remember which checkbox I clicked in a web UI three years ago.&#10;It is all in the code.&#10;And because it is code, my agents can help me manage it.&lt;/p&gt;&#10;&lt;h2 id="references--configuration"&gt;References &amp;amp; Configuration &lt;a class="anchor" href="#references--configuration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All configuration files mentioned in this post are available in my &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;dotfiles repository&lt;/a&gt;.&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/flake.nix" target="_blank" rel="noopener"&gt;&lt;strong&gt;flake.nix&lt;/strong&gt;&lt;/a&gt;: The entry point defining my entire fleet (PC, NUC, HP).&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/hp/networking.nix#L16-L31" target="_blank" rel="noopener"&gt;&lt;strong&gt;networking.nix&lt;/strong&gt;&lt;/a&gt;: The declarative fix for the Intel I219-LM network hang.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/nuc/kodi.nix" target="_blank" rel="noopener"&gt;&lt;strong&gt;kodi.nix&lt;/strong&gt;&lt;/a&gt;: NUC HTPC configuration running Kodi directly on the host.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/pc/ai.nix#L385" target="_blank" rel="noopener"&gt;&lt;strong&gt;ai.nix&lt;/strong&gt;&lt;/a&gt;: Declarative service definition for Faster Whisper.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/hp/incus-overrides.nix" target="_blank" rel="noopener"&gt;&lt;strong&gt;incus-overrides.nix&lt;/strong&gt;&lt;/a&gt;: Overrides used to simulate physical machines inside Incus VMs.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/archive/migrate-lxc.sh" target="_blank" rel="noopener"&gt;&lt;strong&gt;migrate-lxc.sh&lt;/strong&gt;&lt;/a&gt;: Script to import Proxmox &lt;code&gt;vzdump&lt;/code&gt; archives into Incus containers.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/archive/migrate-vm.sh" target="_blank" rel="noopener"&gt;&lt;strong&gt;migrate-vm.sh&lt;/strong&gt;&lt;/a&gt;: Script to import QCOW2 disk images into Incus VMs.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/archive/PROXMOX_MIGRATION.md" target="_blank" rel="noopener"&gt;&lt;strong&gt;PROXMOX_MIGRATION.md&lt;/strong&gt;&lt;/a&gt;: Detailed raw notes and inventory of the migration.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;</description></item><item><title>Automating nightly NixOS builds with a local cache server to avoid local compilation</title><link>https://www.nijho.lt/post/nixos-cache/</link><pubDate>Sat, 29 Nov 2025 09:30:00 +0100</pubDate><guid isPermaLink="false">/post/nixos-cache/</guid><description>&lt;h1 id="the-cuda-compilation-nightmare-how-i-solved-18-hour-builds-with-nixos"&gt;The CUDA compilation nightmare: how I solved 18-hour builds with NixOS&lt;/h1&gt;&#10;&lt;p&gt;I recently migrated my entire fleet to NixOS (read my &lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;full migration story&lt;/a&gt;).&#10;If you use NixOS on &lt;code&gt;unstable&lt;/code&gt; and have heavy dependencies, you&amp;rsquo;ve probably faced the dreaded &amp;ldquo;compiling from source&amp;rdquo; wall.&lt;/p&gt;&#10;&lt;p&gt;It starts innocently enough.&#10;You run &lt;code&gt;nixos-rebuild switch&lt;/code&gt;, expecting a quick update.&#10;Suddenly, Nix decides it needs to compile PyTorch with CUDA support, or even &amp;ldquo;standard&amp;rdquo; desktop apps like Firefox and Thunderbird, from scratch.&lt;/p&gt;&#10;&lt;p&gt;Your fans spin up to 100%.&#10;Your RAM usage creeps up&amp;hellip; 16GB, 32GB, 64GB.&#10;The UI starts to stutter, the mouse freezes, and your music stops.&#10;&lt;strong&gt;OOM Killer&lt;/strong&gt; might save you, but often the system locks up completely.&#10;There is no way to recover; you have to physically hit the reset button.&#10;I recently installed &lt;code&gt;earlyoom&lt;/code&gt;, which helps avoid the total system lockup by killing the process before the kernel panics.&#10;But that is a hollow victory.&#10;It is incredibly frustrating to have a build run for 5 hours across 24 cores at 100% usage, only to be killed right at the linking stage.&#10;The result is the same: I didn&amp;rsquo;t get my update, and I wasted a lot of electricity.&lt;/p&gt;&#10;&lt;p&gt;To fix this, you try the safe route: &lt;code&gt;--cores 1 --max-jobs 1&lt;/code&gt;.&#10;It works, but now your update takes &lt;strong&gt;18 hours&lt;/strong&gt;.&#10;During that time, you can&amp;rsquo;t easily iterate on your system configuration because the Nix lock is held, and your CPU is busy.&lt;/p&gt;&#10;&lt;p&gt;I solved this by building a dedicated, automated build cache that effectively &amp;ldquo;pins&amp;rdquo; my entire fleet to a nightly snapshot.&#10;Here is how it works.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;Update:&lt;/strong&gt; I recently discovered that a significant part of my &amp;ldquo;CUDA nightmare&amp;rdquo; was due to a change in the official CUDA binary cache URL.&#10;It moved from &lt;code&gt;cuda-maintainers.cachix.org&lt;/code&gt; to &lt;code&gt;https://cache.nixos-cuda.org&lt;/code&gt;, and information about this was surprisingly sparse.&#10;Once I added the &lt;a href="https://wiki.nixos.org/wiki/CUDA" target="_blank" rel="noopener"&gt;new cache URL&lt;/a&gt;, many of the heavy builds simply disappeared because I could finally download them.&#10;However, the architecture described below remains valuable for pinning &lt;code&gt;nixpkgs&lt;/code&gt; revisions and avoiding compilation when upstream caches (Hydra or CUDA) are lagging behind &lt;code&gt;nixos-unstable&lt;/code&gt;.&#10;I updated the &lt;a href="https://nixos.wiki/wiki/CUDA" target="_blank" rel="noopener"&gt;nixos.wiki&lt;/a&gt; to reflect this change as well, which showed conflicting information.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="the-inspiration"&gt;The Inspiration &lt;a class="anchor" href="#the-inspiration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This entire setup was born from a &amp;ldquo;nerd snipe&amp;rdquo; just 5 days ago.&#10;I was comparing NixOS configurations with a colleague (see &lt;a href="https://github.com/aos/nix-config" target="_blank" rel="noopener"&gt;his config&lt;/a&gt;), and he mentioned he ran his own cache server.&#10;It instantly clicked.&#10;This was the missing piece.&#10;A dedicated cache server wouldn&amp;rsquo;t just be &amp;ldquo;nice to have&amp;rdquo;—it was the definitive solution to my OOM crashes and 18-hour compilation marathons.&lt;/p&gt;&#10;&lt;h2 id="the-architecture"&gt;The Architecture &lt;a class="anchor" href="#the-architecture" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The core idea is simple: &lt;strong&gt;Never compile heavy packages on your daily driver.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;I manage 3 physical NixOS machines (&lt;code&gt;pc&lt;/code&gt;, &lt;code&gt;nuc&lt;/code&gt;, &lt;code&gt;hp&lt;/code&gt;), and updating them individually was becoming a chore.&#10;So, I set up a dedicated build server (an LXC container named &lt;code&gt;nix-cache&lt;/code&gt;) that does the heavy lifting overnight for the entire fleet.&#10;Here is the high-level workflow:&lt;/p&gt;&#10;&lt;div class="mermaid"&gt;graph TD&#10; subgraph Server&#10; Timer[Systemd Timer 2 AM] --&gt; AutoBuild[auto-build Service]&#10; AutoBuild --&gt;|1. Clone| Git[Git Repo]&#10; Git --&gt;|2. Update| FlakeLock[flake.lock]&#10; FlakeLock --&gt;|3. Build| Store[Nix Store]&#10; Store --&gt;|4. Save Hash| RevFile[hostname.rev]&#10; Store --&gt;|5. Serve| Harmonia[Harmonia Cache]&#10; end&#10;&#10; subgraph Fleet&#10; PC[PC Desktop]&#10; NUC[Intel NUC]&#10; HP[HP EliteDesk]&#10; end&#10;&#10; RevFile --&gt;|1. Read Hash| PC&#10; RevFile --&gt;|1. Read Hash| NUC&#10; RevFile --&gt;|1. Read Hash| HP&#10;&#10; Harmonia -.-&gt;|2. Fetch Binaries| PC&#10; Harmonia -.-&gt;|2. Fetch Binaries| NUC&#10; Harmonia -.-&gt;|2. Fetch Binaries| HP&lt;/div&gt;&#10;&lt;h3 id="1-the-build-server-nix-cache"&gt;1. The Build Server (&lt;code&gt;nix-cache&lt;/code&gt;) &lt;a class="anchor" href="#1-the-build-server-nix-cache" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Every night at 2 AM, a systemd timer triggers my &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/hosts/nix-cache/auto-build.nix" target="_blank" rel="noopener"&gt;&lt;code&gt;auto-build&lt;/code&gt; service&lt;/a&gt;.&#10;This service:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Pulls the latest &lt;code&gt;dotfiles&lt;/code&gt; from git.&lt;/li&gt;&#10;&lt;li&gt;Updates the &lt;code&gt;flake.lock&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Crucially:&lt;/strong&gt; Extracts the exact commit hash of &lt;code&gt;nixpkgs&lt;/code&gt; it just locked.&lt;/li&gt;&#10;&lt;li&gt;Builds the system configurations for all my machines (&lt;code&gt;pc&lt;/code&gt;, &lt;code&gt;nuc&lt;/code&gt;, &lt;code&gt;hp&lt;/code&gt;) using conservative settings (&lt;code&gt;--cores 1&lt;/code&gt;) to ensure stability.&lt;/li&gt;&#10;&lt;li&gt;Saves the successful &lt;code&gt;nixpkgs&lt;/code&gt; commit hash to a simple text file: &lt;code&gt;/var/lib/nix-auto-build/&amp;lt;hostname&amp;gt;.rev&lt;/code&gt;.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="2-the-binary-cache-harmonia"&gt;2. The Binary Cache (Harmonia) &lt;a class="anchor" href="#2-the-binary-cache-harmonia" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The build server runs &lt;a href="https://github.com/nix-community/harmonia" target="_blank" rel="noopener"&gt;Harmonia&lt;/a&gt;, a lightweight binary cache.&#10;Since the builds finished successfully on the server, all the resulting binaries (the &amp;ldquo;store paths&amp;rdquo;) are now waiting in the server&amp;rsquo;s nix store, ready to be served over HTTP.&#10;You can see my Harmonia configuration &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/hosts/nix-cache/harmonia.nix" target="_blank" rel="noopener"&gt;here&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h3 id="3-the-client-nixcacheupdate"&gt;3. The Client (&lt;code&gt;nixcacheupdate&lt;/code&gt;) &lt;a class="anchor" href="#3-the-client-nixcacheupdate" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;This is the key mechanism.&#10;On my workstation, I don&amp;rsquo;t just run &lt;code&gt;nix flake update&lt;/code&gt; (which would likely grab a slightly newer version of nixpkgs than my server built, causing a cache miss).&lt;/p&gt;&#10;&lt;p&gt;Instead, I use a custom script, &lt;a href="https://github.com/basnijholt/dotfiles/blob/4f534bf32fb4396dd86ce631dec00717eab7656d/configs/nixos/upgrade-from-cache.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;upgrade-from-cache.sh&lt;/code&gt;&lt;/a&gt;, which I aliased to &lt;code&gt;nixcacheupdate&lt;/code&gt;.&#10;This script:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;SSHs into the build server and asks: &lt;em&gt;&amp;ldquo;What commit did you successfully build for me last night?&amp;rdquo;&lt;/em&gt;&lt;/li&gt;&#10;&lt;li&gt;Reads the hash from the &lt;code&gt;.rev&lt;/code&gt; file.&lt;/li&gt;&#10;&lt;li&gt;Runs the rebuild with a forced override:&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;nixos-rebuild switch &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --flake .#pc &lt;span class="se"&gt;\&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --override-input nixpkgs github:NixOS/nixpkgs/&amp;lt;REMOTE_COMMIT_HASH&amp;gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-benefits"&gt;The benefits &lt;a class="anchor" href="#the-benefits" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Guaranteed Cache Hits:&lt;/strong&gt; My workstation is mathematically forced to use the exact same package inputs as the server.&#10;Nix calculates the hash, sees the match in the Harmonia cache, and downloads the binary instead of compiling it.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;No More OOMs:&lt;/strong&gt; The heavy lifting happens on a machine where I don&amp;rsquo;t care if the build is slow or memory-intensive.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Iterate Faster:&lt;/strong&gt; I can still tweak my local configuration files (&lt;code&gt;configuration.nix&lt;/code&gt;, &lt;code&gt;home.nix&lt;/code&gt;).&#10;Since changing a config file doesn&amp;rsquo;t alter the &lt;em&gt;source code&lt;/em&gt; of PyTorch, I still get the heavy binaries from the cache, while only locally building the tiny activation scripts.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-result"&gt;The Result &lt;a class="anchor" href="#the-result" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;What used to be a frightening, system-freezing event is now a boring, fast download.&#10;I get the stability of a frozen release with the freshness of &lt;code&gt;nixos-unstable&lt;/code&gt;, minus the compilation heat.&lt;/p&gt;&#10;&lt;p&gt;If you are struggling with CUDA builds on NixOS, stop compiling locally.&#10;Let a server take the heat.&lt;/p&gt;&#10;&lt;h2 id="references--configuration"&gt;References &amp;amp; Configuration &lt;a class="anchor" href="#references--configuration" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;All configuration files mentioned in this post are available in my &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;dotfiles repository&lt;/a&gt;.&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/nix-cache/auto-build.nix" target="_blank" rel="noopener"&gt;&lt;strong&gt;auto-build.nix&lt;/strong&gt;&lt;/a&gt;: The systemd service that orchestrates nightly builds.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/hosts/nix-cache/harmonia.nix" target="_blank" rel="noopener"&gt;&lt;strong&gt;harmonia.nix&lt;/strong&gt;&lt;/a&gt;: Configuration for the Harmonia binary cache server.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles/blob/fa890fa22ee608be2d11ab4f705550337092c414/configs/nixos/upgrade-from-cache.sh" target="_blank" rel="noopener"&gt;&lt;strong&gt;upgrade-from-cache.sh&lt;/strong&gt;&lt;/a&gt;: The client-side script aliased to &lt;code&gt;nixcacheupdate&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/aos/nix-config" target="_blank" rel="noopener"&gt;&lt;strong&gt;aos/nix-config&lt;/strong&gt;&lt;/a&gt;: My colleague&amp;rsquo;s configuration that inspired this setup.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;</description></item><item><title>Switching from Ollama to llama-swap + llama.cpp on NixOS: the power user's choice 🦙</title><link>https://www.nijho.lt/post/llama-nixos/</link><pubDate>Sat, 29 Nov 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/llama-nixos/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-draft-i-never-published"&gt;The draft I never published&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-original-trigger-broken-models"&gt;The original trigger: broken models&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-catalyst-dual-gpus-and-control"&gt;The catalyst: dual GPUs and control&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#api-compatibility-and-the-switch"&gt;API compatibility and the &amp;ldquo;switch&amp;rdquo;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#my-nixos-setup"&gt;My NixOS setup&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#compiler-flags-matter"&gt;Compiler flags matter&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-i-gained-and-lost"&gt;What I gained (and lost)&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#advantages-of-llama-swap--llamacpp"&gt;Advantages of llama-swap + llama.cpp&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-trade-off"&gt;The trade-off&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#conclusion-maturing-as-an-ai-hobbyist"&gt;Conclusion: maturing as an AI hobbyist&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="the-draft-i-never-published"&gt;The draft I never published &lt;a class="anchor" href="#the-draft-i-never-published" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I started writing this blog post four months ago.&#10;Back then, I was frustrated because a specific model I wanted to try—&lt;code&gt;gpt-oss-20b&lt;/code&gt;—was completely broken in &lt;a href="https://ollama.com/" target="_blank" rel="noopener"&gt;Ollama&lt;/a&gt;.&#10;I went down the rabbit hole, set up &lt;a href="https://github.com/mostlygeek/llama-swap" target="_blank" rel="noopener"&gt;&lt;code&gt;llama-swap&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/ggml-org/llama.cpp" target="_blank" rel="noopener"&gt;&lt;code&gt;llama.cpp&lt;/code&gt;&lt;/a&gt;, got the model working perfectly, wrote half this post&amp;hellip; and then I stopped.&lt;/p&gt;&#10;&lt;p&gt;Why? &lt;strong&gt;Laziness.&lt;/strong&gt;&#10;Once the novelty of that specific model wore off, I drifted back to Ollama.&#10;The real convenience of Ollama was never the &lt;code&gt;ollama run&lt;/code&gt; command—I almost exclusively interact with my models via the API using my own tools like &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;agent-cli&lt;/a&gt;.&#10;The convenience was &lt;code&gt;ollama pull&lt;/code&gt;.&#10;Being able to grab a model with one command and have it &amp;ldquo;just work&amp;rdquo; was great.&lt;/p&gt;&#10;&lt;p&gt;But as a &lt;a href="https://www.nijho.lt/post/proxmox-to-nixos/"&gt;NixOS&lt;/a&gt; user, this imperative convenience is actually a flaw.&#10;I want my system to be declarative.&#10;I want my model configuration committed to git, not hiding in a local database.&#10;So I let convenience win for a while, but it always felt wrong.&lt;/p&gt;&#10;&lt;p&gt;But last month, that changed.&#10;I upgraded my hobbyist AI rig by adding a &lt;strong&gt;second RTX 3090&lt;/strong&gt;.&#10;Suddenly, I had 48GB of VRAM and a whole new set of problems—and possibilities.&#10;I wanted to run massive models (like &lt;code&gt;gpt-oss-120b&lt;/code&gt; or &lt;code&gt;Qwen-3-VL-32B&lt;/code&gt; with a huge context window).&#10;I needed to balance layers between two GPUs.&#10;I needed to spill specific parts of the model into system RAM without crashing.&lt;/p&gt;&#10;&lt;p&gt;When you start pushing hardware to its limits, &amp;ldquo;magic&amp;rdquo; abstractions like Ollama stop being helpful and start getting in the way.&#10;I realized that &lt;code&gt;llama.cpp&lt;/code&gt; isn&amp;rsquo;t just a backend; it is &lt;em&gt;the&lt;/em&gt; place where development happens.&#10;If you want to use split-mode inference, granular CPU offloading, or the latest quantization tricks immediately, there is no alternative.&lt;/p&gt;&#10;&lt;p&gt;So, I dusted off this draft, updated my Nix configuration, and I&amp;rsquo;ve been running &lt;code&gt;llama-swap&lt;/code&gt; full-time for a month.&#10;I&amp;rsquo;m finally ready to vouch for it.&lt;/p&gt;&#10;&lt;h2 id="the-original-trigger-broken-models"&gt;The original trigger: broken models &lt;a class="anchor" href="#the-original-trigger-broken-models" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Four months ago, my frustration stemmed from compatibility.&#10;I was trying to run &lt;code&gt;gpt-oss-20b&lt;/code&gt;, a model that required specific chat templates and GGUF handling that &lt;a href="https://ollama.com/" target="_blank" rel="noopener"&gt;Ollama&lt;/a&gt; simply broke.&lt;/p&gt;&#10;&lt;p&gt;The maintainer of &lt;a href="https://github.com/ggml-org/llama.cpp" target="_blank" rel="noopener"&gt;&lt;code&gt;llama.cpp&lt;/code&gt;&lt;/a&gt;, Georgi Gerganov, &lt;a href="https://github.com/ollama/ollama/issues/11714#issuecomment-3172893576" target="_blank" rel="noopener"&gt;explained it perfectly&lt;/a&gt; regarding the gpt-oss debacle:&#10;Ollama forked the ggml inference engine to rush out &amp;ldquo;day-1 support&amp;rdquo; for gpt-oss without coordinating with upstream.&#10;The result? Their implementation was not only incompatible with standard GGUF files but also significantly slower and unoptimized.&lt;/p&gt;&#10;&lt;p&gt;Benchmarks at the time showed Ollama had significant performance overhead—often 20-30% slower inference speeds compared to running &lt;code&gt;llama.cpp&lt;/code&gt; directly.&lt;/p&gt;&#10;&lt;p&gt;This pattern means Ollama will always be behind &lt;code&gt;llama.cpp&lt;/code&gt;.&#10;Meanwhile, I&amp;rsquo;ve had &lt;a href="https://github.com/ollama/ollama/pull/11249" target="_blank" rel="noopener"&gt;a pull request&lt;/a&gt; sitting unreviewed for over a month that fixes their broken OpenAI API.&#10;Compare that to &lt;code&gt;llama.cpp&lt;/code&gt;: I submitted &lt;a href="https://github.com/ggml-org/llama.cpp/pull/15295" target="_blank" rel="noopener"&gt;a PR there&lt;/a&gt; and it was merged in less than an hour.&#10;If you want the latest features &lt;em&gt;now&lt;/em&gt; (and a responsive community), you go to the source.&lt;/p&gt;&#10;&lt;h2 id="the-catalyst-dual-gpus-and-control"&gt;The catalyst: dual GPUs and control &lt;a class="anchor" href="#the-catalyst-dual-gpus-and-control" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;With a single GPU, you usually either fit the model or you don&amp;rsquo;t.&#10;With two GPUs (and 64GB of system RAM), things get interesting.&#10;You enter the territory of &lt;strong&gt;heterogeneous inference&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Ollama tries to handle splitting automatically, but I found myself fighting it.&#10;I wanted to say: &lt;em&gt;&amp;ldquo;Put 40 layers on GPU 0, 40 layers on GPU 1, and keep the KV cache here.&amp;rdquo;&lt;/em&gt;&#10;Or: &lt;em&gt;&amp;ldquo;This model is slightly too big for VRAM; I want to offload exactly the last 10% to system RAM.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;With &lt;code&gt;llama.cpp&lt;/code&gt; directly, this is just a command line flag.&#10;With &lt;code&gt;llama-swap&lt;/code&gt;, I can define this behavior per-model in a config file:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;gpt-oss:120b&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="sd"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; ${pkgs.llama-cpp}/bin/llama-server&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; -hf ggml-org/gpt-oss-120b-GGUF&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --port ${PORT}&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --ctx-size 65536&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --split-mode layer&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --tensor-split 3,1.3 # Tuned balance between my GPUs&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --n-cpu-moe 15 # Offload 15 experts to CPU RAM&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --threads 8&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; --chat-template-kwargs &amp;#39;{&amp;#34;reasoning_effort&amp;#34;: &amp;#34;high&amp;#34;}&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This level of granularity turned my rig from a &amp;ldquo;black box&amp;rdquo; into a tunable instrument.&#10;The &lt;code&gt;--tensor-split&lt;/code&gt; and &lt;code&gt;--n-cpu-moe&lt;/code&gt; flags allow me to run a 120B parameter model that technically shouldn&amp;rsquo;t fit, by carefully balancing the load across both GPUs and system RAM.&lt;/p&gt;&#10;&lt;h2 id="api-compatibility-and-the-switch"&gt;API compatibility and the &amp;ldquo;switch&amp;rdquo; &lt;a class="anchor" href="#api-compatibility-and-the-switch" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of the reasons I hesitated to switch was the fear of breaking my existing workflows.&#10;I use &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;agent-cli&lt;/a&gt; and other custom Python scripts daily.&#10;But it turned out to be a non-issue.&#10;Both Ollama and &lt;code&gt;llama-swap&lt;/code&gt; (wrapping &lt;code&gt;llama-server&lt;/code&gt;) expose an OpenAI-compatible API.&lt;/p&gt;&#10;&lt;p&gt;Once I adopted the pattern of setting a custom &lt;code&gt;OPENAI_BASE_URL&lt;/code&gt; in my projects, the backend became irrelevant.&#10;My tools don&amp;rsquo;t care if they are talking to &lt;code&gt;api.openai.com&lt;/code&gt;, a local Ollama instance, or &lt;code&gt;llama-swap&lt;/code&gt;.&#10;They just send JSON and get JSON back.&#10;This standardization meant I could swap the entire inference engine underneath my applications without changing a single line of their code.&lt;/p&gt;&#10;&lt;h2 id="my-nixos-setup"&gt;My NixOS setup &lt;a class="anchor" href="#my-nixos-setup" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Since I manage my entire system with Nix, setting up &lt;code&gt;llama-swap&lt;/code&gt; and pinning &lt;code&gt;llama-cpp&lt;/code&gt; to the absolute bleeding edge was surprisingly elegant.&#10;I even wrote an &lt;a href="https://github.com/basnijholt/dotfiles/blob/51c7af46e62a7d13b4ff497380c8b58c05ed81c8/configs/nixos/scripts/update_overrides.py" target="_blank" rel="noopener"&gt;auto-update script&lt;/a&gt; to ensure I&amp;rsquo;m always on the latest commit.&lt;/p&gt;&#10;&lt;p&gt;This is where my &lt;a href="https://www.nijho.lt/post/nixos-cache/"&gt;NixOS build cache&lt;/a&gt; shines.&#10;Unlike Ollama, which releases every few weeks, &lt;code&gt;llama.cpp&lt;/code&gt; can have multiple releases &lt;em&gt;a day&lt;/em&gt;.&#10;My cache server runs this update script automatically, builds the new binaries, and serves them to my workstation.&#10;I get the absolute latest performance improvements without ever compiling source code locally.&lt;/p&gt;&#10;&lt;h3 id="compiler-flags-matter"&gt;Compiler flags matter &lt;a class="anchor" href="#compiler-flags-matter" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;One critical lesson I learned: default builds matter.&#10;Initially, I was getting a measly &lt;strong&gt;8 tokens/sec&lt;/strong&gt; on &lt;code&gt;gpt-oss:120b&lt;/code&gt;.&#10;It turned out the default &lt;code&gt;llama.cpp&lt;/code&gt; package wasn&amp;rsquo;t enabling BLAS or native CPU optimizations, crippling the layers I offloaded to system RAM.&lt;/p&gt;&#10;&lt;p&gt;By overriding the package to enable &lt;code&gt;blasSupport&lt;/code&gt; and passing &lt;code&gt;-DGGML_NATIVE=ON&lt;/code&gt; (as seen below), performance jumped to &lt;strong&gt;50 tokens/sec&lt;/strong&gt;.&#10;This is another reason why I prefer managing this via Nix: I can enforce these compile-time flags declaratively.&lt;/p&gt;&#10;&lt;p&gt;Here&amp;rsquo;s my complete configuration (see &lt;a href="https://github.com/basnijholt/dotfiles/blob/51c7af46e62a7d13b4ff497380c8b58c05ed81c8/configs/nixos/hosts/pc/package-overrides.nix#L28-L76" target="_blank" rel="noopener"&gt;&lt;code&gt;package-overrides.nix&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/basnijholt/dotfiles/blob/51c7af46e62a7d13b4ff497380c8b58c05ed81c8/configs/nixos/hosts/pc/ai.nix#L360-L380" target="_blank" rel="noopener"&gt;&lt;code&gt;ai.nix&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-nix" data-lang="nix"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Override llama-cpp to latest version with CUDA support&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;llama-cpp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;llama-cpp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;override&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cudaSupport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;rocmSupport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;metalSupport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Enable BLAS for optimized CPU layer performance (OpenBLAS)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;blasSupport&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;overrideAttrs&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oldAttrs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;rec&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;version&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;7205&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;src&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fetchFromGitHub&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;owner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ggml-org&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;repo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;llama.cpp&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;tag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;b&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;sha256-1CcYbc8RWAPVz8hoxKEmbAgQesC1oGFZ3fhfuU5vmOc=&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;leaveDotGit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;postFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; git -C &amp;#34;$out&amp;#34; rev-parse --short HEAD &amp;gt; $out/COMMIT&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; find &amp;#34;$out&amp;#34; -name .git -print0 | xargs -0 rm -rf&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; &amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Enable native CPU optimizations (AVX, AVX2, etc.)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;cmakeFlags&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oldAttrs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cmakeFlags&lt;/span&gt; &lt;span class="n"&gt;or&lt;/span&gt; &lt;span class="p"&gt;[])&lt;/span&gt; &lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;-DGGML_NATIVE=ON&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Disable Nix&amp;#39;s march=native stripping&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;preConfigure&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; export NIX_ENFORCE_NO_NATIVE=0&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;oldAttrs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;preConfigure&lt;/span&gt; &lt;span class="n"&gt;or&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; &amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;});&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# llama-swap from GitHub releases&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;llama-swap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;runCommand&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;llama-swap&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&amp;#39;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; mkdir -p $out/bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; tar -xzf &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fetchurl&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;https://github.com/mostlygeek/llama-swap/releases/download/v175/llama-swap_175_linux_amd64.tar.gz&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;hash&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;sha256-zeyVz0ldMxV4HKK+u5TtAozfRI6IJmeBo92IJTgkGrQ=&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s1"&gt; -C $out/bin&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; chmod +x $out/bin/llama-swap&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Configure llama-swap as a systemd service&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;systemd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;llama-swap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;llama-swap - OpenAI compatible proxy with automatic model swapping&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;after&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;network.target&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;wantedBy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;multi-user.target&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;serviceConfig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;simple&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;User&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;basnijholt&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Group&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;users&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Point to your declarative config file&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;ExecStart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="n"&gt;pkgs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;llama-swap&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/bin/llama-swap --config /etc/llama-swap/config.yaml --listen 0.0.0.0:9292 --watch-config&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Restart&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;always&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;RestartSec&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Environment for CUDA support&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;Environment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;PATH=/run/current-system/sw/bin&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;];&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;};&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="what-i-gained-and-lost"&gt;What I gained (and lost) &lt;a class="anchor" href="#what-i-gained-and-lost" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;h3 id="advantages-of-llama-swap--llamacpp"&gt;Advantages of llama-swap + llama.cpp &lt;a class="anchor" href="#advantages-of-llama-swap--llamacpp" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Heterogeneous compute&lt;/strong&gt;: Perfectly balance loads between GPUs and CPU RAM.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Bleeding edge&lt;/strong&gt;: I use features (like new quantization types) the day they land in &lt;code&gt;llama.cpp&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Zero idle VRAM&lt;/strong&gt;: Models unload completely when not in use.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Transparent operation&lt;/strong&gt;: No hidden prompts or &amp;ldquo;helpful&amp;rdquo; formatting that breaks complex tasks.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-trade-off"&gt;The trade-off &lt;a class="anchor" href="#the-trade-off" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The main trade-off is &amp;ldquo;laziness.&amp;rdquo;&#10;You can&amp;rsquo;t just &lt;code&gt;ollama pull new-model&lt;/code&gt; and have it appear.&#10;You have to find the GGUF on HuggingFace, decide on the quantization (Q4_K_M? Q6_K?), and add 5 lines of YAML to your config.&lt;/p&gt;&#10;&lt;p&gt;But honestly? That&amp;rsquo;s a feature, not a bug.&#10;It forces you to understand &lt;em&gt;what&lt;/em&gt; you are running.&#10;It stops you from running a quantized model that is too stupid for your task just because it was the default.&#10;And for a NixOS user, putting that configuration into code instead of a hidden database is exactly how it should be.&lt;/p&gt;&#10;&lt;h2 id="conclusion-maturing-as-an-ai-hobbyist"&gt;Conclusion: maturing as an AI hobbyist &lt;a class="anchor" href="#conclusion-maturing-as-an-ai-hobbyist" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My switch back to &lt;code&gt;llama-swap&lt;/code&gt; wasn&amp;rsquo;t about fixing a bug; it was about outgrowing a tool.&#10;Ollama is the &amp;ldquo;starter bike&amp;rdquo; of local AI—fantastic for getting rolling.&#10;But when you add a second GPU, start caring about tokens per second, and want to maximize every gigabyte of your 48GB VRAM buffer, you need a manual transmission.&lt;/p&gt;&#10;&lt;p&gt;For anyone else building a hobbyist multi-GPU rig: stop fighting the abstraction.&#10;Go to the source. The control is worth it.&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;&lt;em&gt;Check out my &lt;a href="https://github.com/basnijholt/dotfiles/tree/51c7af46e62a7d13b4ff497380c8b58c05ed81c8/configs/nixos" target="_blank" rel="noopener"&gt;NixOS configuration&lt;/a&gt; for the complete setup!&lt;/em&gt;&lt;/p&gt;&#10;</description></item><item><title>Gemini 3 Pro: First Impressions</title><link>https://www.nijho.lt/post/gemini-3-pro-first-impressions/</link><pubDate>Wed, 19 Nov 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/gemini-3-pro-first-impressions/</guid><description>&lt;p&gt;I&amp;rsquo;m a huge fan of &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;agentic&lt;/a&gt; &lt;a href="https://www.nijho.lt/post/agentic-mobile-workflow/"&gt;coding&lt;/a&gt;.&#10;I have the maximum subscriptions for both Claude and ChatGPT Pro, and since writing my &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;agentic coding&lt;/a&gt; post, I mostly moved from Claude Code to Codex CLI with GPT-5 for my work that requires more complex reasoning.&#10;Using Claude Code often feels frustrating in comparison now.&lt;/p&gt;&#10;&lt;p&gt;I also frequently pit them against each other, drafting parallel plans with each tool (I&amp;rsquo;ve done this at least 50 times).&#10;The verdict is consistent.&#10;&lt;strong&gt;Claude Code, without exception, says that GPT‑5&amp;rsquo;s solution is superior&lt;/strong&gt;, admitting it is more elegant and robust.&#10;Claude also misses bugs during PR reviews that GPT-5 catches immediately.&lt;/p&gt;&#10;&lt;p&gt;That said, &lt;strong&gt;Claude Code is significantly faster&lt;/strong&gt;, which makes it my go-to for simple refactors.&#10;I also prefer its writing style for conversational answers and documentation.&lt;/p&gt;&#10;&lt;p&gt;But looking at the charts on &lt;strong&gt;&lt;a href="https://artificialanalysis.ai/" target="_blank" rel="noopener"&gt;Artificial Analysis&lt;/a&gt;&lt;/strong&gt;, the new &lt;strong&gt;Gemini 3 Pro&lt;/strong&gt; looks truly impressive.&#10;It&amp;rsquo;s at the top of nearly every benchmark.&#10;I&amp;rsquo;m excited for Gemini to potentially take over some of GPT‑5&amp;rsquo;s workload, so when &lt;strong&gt;Gemini 3 Pro Preview&lt;/strong&gt; came out yesterday, I had to try it.&lt;/p&gt;&#10;&lt;h2 id="the-good-raw-power"&gt;The good: raw power &lt;a class="anchor" href="#the-good-raw-power" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;First off, the model is quite powerful.&#10;Last night, I built a complex new feature for my &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; project in just two hours: a &lt;strong&gt;RAG (Retrieval-Augmented Generation) proxy server&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;This tool acts as a middleware that sits between any OpenAI-compatible client and server (like Ollama or vLLM).&#10;The server watches a specific folder, automatically indexes any PDF, Markdown, or text files into a local ChromaDB vector store, and injects relevant context into your prompts transparently.&#10;You can see the full implementation in &lt;a href="https://github.com/basnijholt/agent-cli/pull/79" target="_blank" rel="noopener"&gt;PR #79&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;It even handles dynamic re-indexing when I drop new files in!&#10;The speed and code quality for this task were genuinely impressive, and it handled the complexity of the RAG integration surprisingly well.&lt;/p&gt;&#10;&lt;h2 id="the-bad-panic-attacks-and-infinite-loops"&gt;The bad: panic attacks and infinite loops &lt;a class="anchor" href="#the-bad-panic-attacks-and-infinite-loops" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;However, the experience wasn&amp;rsquo;t without its &amp;ldquo;personality quirks.&amp;rdquo;&#10;Twice, Gemini got stuck in a loop saying &lt;em&gt;&amp;ldquo;Should I? I should&amp;rdquo;&lt;/em&gt; over and over again.&#10;Or the following also happened:&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/gemini-3-pro-first-impressions/infinite-loop_hu_234c7407851f9273.webp" srcset="https://www.nijho.lt/post/gemini-3-pro-first-impressions/infinite-loop_hu_8f9dd754d34e9bda.webp 272w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/infinite-loop_hu_234c7407851f9273.webp 516w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/infinite-loop_hu_3023867168cf93e2.webp 815w" sizes="auto, (max-width: 760px) 100vw, 720px" width="516" height="760" alt="Gemini infinite loop" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;p&gt;It also has a bad habit of amending commits multiple times and force-pushing them.&#10;For me the Git history is a critical source of truth, and I don&amp;rsquo;t like rewriting it because I might just have reviewed those commits already.&lt;/p&gt;&#10;&lt;h3 id="the-interface-friction"&gt;The interface friction &lt;a class="anchor" href="#the-interface-friction" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I also found the Gemini CLI interface frustrating.&#10;Basic tasks like selecting text or scrolling up are surprisingly difficult.&#10;I&amp;rsquo;m not sure why they chose this design or why they feel the need to deviate from standard CLI behavior.&#10;It feels like unnecessary friction in an otherwise promising tool.&lt;/p&gt;&#10;&lt;h3 id="proofreading-this-post"&gt;Proofreading this post &lt;a class="anchor" href="#proofreading-this-post" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I also asked Gemini to proofread this very blog post.&#10;It made some suggestions—some I liked, others I didn&amp;rsquo;t, so I reverted the ones I didn&amp;rsquo;t want.&#10;But in every single subsequent iteration, it would forcefully re-apply its rejected changes, adding emojis I had removed or rewriting sentences I had explicitly restored.&lt;/p&gt;&#10;&lt;h3 id="the-main-branch-incident"&gt;The &amp;ldquo;main branch&amp;rdquo; incident &lt;a class="anchor" href="#the-main-branch-incident" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Another scary moment: I asked if the PR was ready to be merged into &lt;code&gt;main&lt;/code&gt;, and it went ahead and checked out the &lt;code&gt;main&lt;/code&gt; branch and merged everything locally.&#10;If I hadn&amp;rsquo;t stopped it, I&amp;rsquo;m pretty sure it would have pushed the changes to the &lt;code&gt;main&lt;/code&gt; branch directly as well.&#10;I tend to use &amp;ldquo;yolo mode&amp;rdquo; for agentic coding because I feel like Git has my back, but this feels like a dangerous path to go down.&lt;/p&gt;&#10;&lt;p&gt;And indeed, while writing this post, &lt;strong&gt;it actually happened&lt;/strong&gt;.&#10;Gemini merged my pull request without my permission.&lt;/p&gt;&#10;&lt;p&gt;My prompt was &lt;code&gt;&amp;gt; should the README reflect this?&lt;/code&gt; and before that I asked to review the PR.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/gemini-3-pro-first-impressions/merge_hu_719c4aa620a5a59a.webp" srcset="https://www.nijho.lt/post/gemini-3-pro-first-impressions/merge_hu_44f4ede1b23e43f5.webp 400w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/merge_hu_719c4aa620a5a59a.webp 760w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/merge_hu_fcec307dabb3ec8f.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="326" alt="Gemini merging without permission" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;p&gt;When I asked &lt;em&gt;why&lt;/em&gt; it merged it, it instantly force-pushed to &lt;code&gt;main&lt;/code&gt; again!&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/gemini-3-pro-first-impressions/force-push-again_hu_a7f66199c342259b.webp" srcset="https://www.nijho.lt/post/gemini-3-pro-first-impressions/force-push-again_hu_3884bda6d7ac695f.webp 400w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/force-push-again_hu_a7f66199c342259b.webp 760w, https://www.nijho.lt/post/gemini-3-pro-first-impressions/force-push-again_hu_8a797e9907cbcd9e.webp 1200w" sizes="auto, (max-width: 760px) 100vw, 720px" width="760" height="379" alt="Gemini force pushing to main" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;h3 id="artifacts-and-existential-crises"&gt;Artifacts and existential crises &lt;a class="anchor" href="#artifacts-and-existential-crises" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Also, when it commits, it just adds &lt;em&gt;all&lt;/em&gt; files, including debugging logs and build artifacts.&#10;When it realizes its mistake, it tries to fix it.&#10;But if I try to help at the same time (like removing the files myself while it&amp;rsquo;s thinking), it gets extremely confused.&lt;/p&gt;&#10;&lt;p&gt;It spirals into an &lt;strong&gt;existential crisis&lt;/strong&gt;, claiming that I committed the file but now &amp;ldquo;it is gone.&amp;rdquo;&#10;&lt;em&gt;&amp;ldquo;What is going on?&amp;rdquo;&lt;/em&gt; it asks, spending a lot of tokens (and time) looking at &lt;code&gt;git reflog&lt;/code&gt;s and questioning its own existence.&#10;Even when I stop it and explicitly say that I deleted the file and to please continue, it completely ignores me and continues its panic attack.&#10;I experienced this pattern of ignoring instructions multiple times.&lt;/p&gt;&#10;&lt;h2 id="conclusion"&gt;Conclusion &lt;a class="anchor" href="#conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Gemini 3 Pro shows massive potential.&#10;The raw coding ability is there, and building a &lt;strong&gt;clean&lt;/strong&gt; RAG proxy in two hours is great!&#10;But the agentic behavior needs some serious work: the loops, the force pushes, ignoring instructions, and the confusion when reality doesn&amp;rsquo;t match its internal state.&lt;/p&gt;&#10;&lt;p&gt;This is just &lt;strong&gt;day one&lt;/strong&gt;, so I&amp;rsquo;m confident many of these issues will get ironed out.&#10;I don&amp;rsquo;t love the interface, but given that &lt;a href="https://github.com/google-gemini/gemini-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;gemini-cli&lt;/code&gt;&lt;/a&gt; is open source with ≈400 contributors, I expect rapid improvements, especially now that the model is finally good with agentic workflows!&lt;/p&gt;&#10;</description></item><item><title>Coding from my phone 📱</title><link>https://www.nijho.lt/post/agentic-mobile-workflow/</link><pubDate>Mon, 20 Oct 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/agentic-mobile-workflow/</guid><description>&lt;p&gt;I am dictating this post at ten kilometers altitude on a flight home from Mexico, Blink Shell open on my iPhone, while an agentic assistant on my &lt;a href="https://nixos.org/" target="_blank" rel="noopener"&gt;NixOS&lt;/a&gt; machine writes an initial draft for this post.&#10;Admittedly, I’m a little addicted to agentic coding: when an idea pops up, I want to jump on it right away—even if that means doing it from a cramped seat in the sky.&#10;This is the workflow I’ve arrived at after trying many alternatives, it extends &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;my agentic coding write-up&lt;/a&gt; and the self-hosted AI obsession in &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;my local AI journey&lt;/a&gt;.&#10;It&amp;rsquo;s my backup plan for those moments when a computer simply isn&amp;rsquo;t nearby—the rest of the time I&amp;rsquo;m still at a keyboard like any other developer.&#10;This is in no way a replacement for a proper computer/laptop workflow but gets the job done when needed.&#10;It&amp;rsquo;s a personal, mostly open-source stack built around &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt;—my local-first voice layer.&#10;Here&amp;rsquo;s how it works: I speak into my phone, the audio goes to &lt;a href="https://github.com/SYSTRAN/faster-whisper-server" target="_blank" rel="noopener"&gt;FasterWhisper&lt;/a&gt; for transcription, &lt;a href="https://ollama.com/" target="_blank" rel="noopener"&gt;Ollama&lt;/a&gt; cleans up the text, and it lands on my clipboard ready to paste.&#10;My iOS Shortcut handles this through a small HTTP interface that agent-cli exposes.&#10;The coding agent itself still uses the best proprietary model I can access.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Meta: I&amp;rsquo;m writing about agentic coding on mobile from my actual phone.&#10;It&amp;rsquo;s not the most efficient way to write, but it gets the job done — during a 6.5‑hour flight I dictated and iterated this entire post.&#10;Each iteration was a commit: dictate changes, review the diff, refine, commit, repeat.&#10;See all &lt;a href="https://github.com/basnijholt/nijho.lt/pull/40" target="_blank" rel="noopener"&gt;50+ commits in PR #40&lt;/a&gt; for the full iteration trail.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; iPhone → WireGuard → Blink+Mosh → Zellij.&#10;I dictate via a Shortcut → FasterWhisper (transcribe) → Ollama (polish) → clipboard, then paste into Codex CLI using OpenAI’s &lt;code&gt;gpt-5-codex-high&lt;/code&gt;.&#10;Everything is local except the model.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-why-phone-coding-works-now"&gt;1. Why Phone Coding Works Now&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-constraints-and-trade-offs"&gt;2. Constraints and Trade-offs&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-layer-1-wireguard-from-the-router"&gt;3. Layer 1: WireGuard From the Router&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-layer-2-blink-shell--mosh-for-durable-sessions"&gt;4. Layer 2: Blink Shell + Mosh for Durable Sessions&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-layer-3-zellij-layouts"&gt;5. Layer 3: Zellij Layouts&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-layer-4-agent-cli-server"&gt;6. Layer 4: &lt;code&gt;agent-cli&lt;/code&gt; Server&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-layer-5-the-ios-shortcut-pipeline"&gt;7. Layer 5: The iOS Shortcut Pipeline&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-workflow-in-practice"&gt;8. Workflow in Practice&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-conclusion-and-further-reading"&gt;9. Conclusion and Further Reading&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-why-phone-coding-works-now"&gt;1. Why Phone Coding Works Now &lt;a class="anchor" href="#1-why-phone-coding-works-now" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For years I used &lt;a href="https://ish.app/" target="_blank" rel="noopener"&gt;&lt;strong&gt;iSH&lt;/strong&gt;&lt;/a&gt; (a full Alpine Linux emulator) with SSH to hop into servers from my phone, but dropped connections were a constant frustration (Mosh fixes this, more on that later).&#10;Because coding on a phone keyboard is terrible, I kept it to tiny configuration tweaks or one-off fixes of a few characters.&#10;Agentic tools changed that: with a CLI coding agent, I don’t need to type the code—I describe the change, review the patch, and run it.&#10;That made meaningful work on the phone possible for the first time, for those moments when a computer isn’t around.&lt;/p&gt;&#10;&lt;p&gt;I tried &lt;strong&gt;VS Code in the browser&lt;/strong&gt;, bounced between &lt;strong&gt;iSH&lt;/strong&gt; and &lt;strong&gt;Terminus&lt;/strong&gt; for SSH, and even lived inside a handful of in-browser terminal clients.&#10;I also spent time with mobile companions like &lt;a href="https://happy.engineering/" target="_blank" rel="noopener"&gt;&lt;strong&gt;Happy&lt;/strong&gt;&lt;/a&gt; and &lt;a href="https://www.ycombinator.com/companies/omnara" target="_blank" rel="noopener"&gt;&lt;strong&gt;Omnara&lt;/strong&gt;&lt;/a&gt;, both designed to mirror Claude Code sessions on the phone, but they still felt like extra steps between me and my actual terminal.&#10;That friction pushed me toward a phone‑ready, self‑hosted workflow that still gives me raw SSH access to my own machine when the computer is out of reach.&lt;/p&gt;&#10;&lt;p&gt;This post is based on the way I develop software today.&#10;Your mileage may vary, but if you also care about privacy, open tooling, and reproducible environments, I think there are useful pieces here.&lt;/p&gt;&#10;&lt;h2 id="2-constraints-and-trade-offs"&gt;2. Constraints and Trade-offs &lt;a class="anchor" href="#2-constraints-and-trade-offs" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This setup grew organically over time. What emerged are less strict requirements and more happy accidents that turned into core benefits:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Single trust boundary:&lt;/strong&gt; Only the model provider (OpenAI) sees code context; audio and automation stay local, and I avoid any additional third‑party relays.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Resilient sessions:&lt;/strong&gt; Connections should survive sleep and spotty networks.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Voice-friendly:&lt;/strong&gt; Dictation should be accurate enough that I can trust it.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reproducible config:&lt;/strong&gt; The entire stack must live in my &lt;a href="https://www.nijho.lt/post/dotfiles/"&gt;dotfiles&lt;/a&gt; and &lt;a href="https://github.com/basnijholt/dotfiles/tree/8f6bf0b7219195a46a3e010d3538e1e449634db7/configs/nixos" target="_blank" rel="noopener"&gt;NixOS configuration&lt;/a&gt;.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;To give you a sense of what I tried, here is the short comparison that convinced me to roll my own:&lt;/p&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Approach&lt;/th&gt;&#10;&lt;th&gt;Pros&lt;/th&gt;&#10;&lt;th&gt;Why I moved on&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;VS Code in the browser&lt;/td&gt;&#10;&lt;td&gt;Familiar editor UI&lt;/td&gt;&#10;&lt;td&gt;Needs a steady connection and still lives outside my dotfiles comfort zone&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;iSH / Terminus SSH&lt;/td&gt;&#10;&lt;td&gt;Works without extra infrastructure&lt;/td&gt;&#10;&lt;td&gt;Laggy, no Mosh, and awkward keybindings&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;In-browser terminals&lt;/td&gt;&#10;&lt;td&gt;Instant access from anywhere&lt;/td&gt;&#10;&lt;td&gt;Poor copy/paste ergonomics and flaky mobile keyboards&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://apps.apple.com/us/app/happy-codex-claude-code-app/id6748571505" target="_blank" rel="noopener"&gt;Happy&lt;/a&gt; (Claude Code companion)&lt;/td&gt;&#10;&lt;td&gt;Push notifications, encrypted mobile UI for Claude Code&lt;/td&gt;&#10;&lt;td&gt;Requires wrapping every session with a separate CLI and still abstracts away my shell, and was quite buggy for me&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;&lt;a href="https://omnara.com" target="_blank" rel="noopener"&gt;Omnara&lt;/a&gt; (agent command center)&lt;/td&gt;&#10;&lt;td&gt;Centralizes Claude Code/Codex sessions with terminal replay&lt;/td&gt;&#10;&lt;td&gt;Proxies via their servers; I already trust OpenAI for the model and don&amp;rsquo;t want another third‑party handling my code&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The stack below gives me the resilience of Mosh, the ergonomics of Zellij, and full control over the AI layer.&lt;/p&gt;&#10;&lt;h2 id="3-layer-1-wireguard-from-the-router"&gt;3. Layer 1: WireGuard From the Router &lt;a class="anchor" href="#3-layer-1-wireguard-from-the-router" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://www.wireguard.com/" target="_blank" rel="noopener"&gt;WireGuard&lt;/a&gt; is a modern VPN that lets me securely access my home network from anywhere.&#10;I terminate WireGuard on my router so every device in the house (and on the road) can dial home with the same config.&#10;(If you want something easier to set up without opening ports, &lt;a href="https://tailscale.com/" target="_blank" rel="noopener"&gt;Tailscale&lt;/a&gt; is a more user-friendly option.)&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Server:&lt;/strong&gt; ASUS XT8 router with WireGuard enabled via the router UI.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Client:&lt;/strong&gt; The WireGuard iOS app with &lt;code&gt;On-Demand&lt;/code&gt; rules so the tunnel flips on whenever I am off trusted Wi-Fi.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;DNS:&lt;/strong&gt; All mobile sessions resolve through my home DNS, so &lt;code&gt;git.nijho.lt&lt;/code&gt; and internal services resolve instantly.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This gives Blink a local-LAN address for my desktop &lt;code&gt;nixos&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h2 id="4-layer-2-blink-shell--mosh-for-durable-sessions"&gt;4. Layer 2: Blink Shell + Mosh for Durable Sessions &lt;a class="anchor" href="#4-layer-2-blink-shell--mosh-for-durable-sessions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;What is &lt;a href="https://mosh.org/" target="_blank" rel="noopener"&gt;Mosh&lt;/a&gt;?&#10;It&amp;rsquo;s like SSH, but it stays connected when the network changes or the phone sleeps, and it feels faster on bad connections.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://blink.sh/" target="_blank" rel="noopener"&gt;Blink Shell&lt;/a&gt; is my daily driver on iOS because it pairs beautifully with Mosh and has great keyboard ergonomics.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I launch sessions using &lt;code&gt;mosh bas@nixos -- zellij attach --create phone&lt;/code&gt; (&lt;a href="https://zellij.dev/" target="_blank" rel="noopener"&gt;Zellij&lt;/a&gt; is my terminal multiplexer—more on that in the next section).&lt;/li&gt;&#10;&lt;li&gt;Mosh smooths over spotty LTE and keeps my session alive when the phone sleeps.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Mosh keeps the session responsive across flaky networks and sleep.&lt;/p&gt;&#10;&lt;h2 id="5-layer-3-zellij-layouts"&gt;5. Layer 3: Zellij Layouts &lt;a class="anchor" href="#5-layer-3-zellij-layouts" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I use &lt;strong&gt;Zellij&lt;/strong&gt; as my terminal multiplexer for mobile work.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;I stick to the defaults and use a couple of predefined layouts (e.g., a &amp;ldquo;phone&amp;rdquo; layout with editor + shell panes).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Ergonomics matter even more on a glass keyboard, so I lean on a few shell helpers:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/ajeetdsouza/zoxide" target="_blank" rel="noopener"&gt;&lt;code&gt;zoxide&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; means I can jump between repos with &lt;code&gt;z foo&lt;/code&gt; instead of pecking long paths.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Single-character aliases&lt;/strong&gt; like &lt;code&gt;p&lt;/code&gt; for &lt;code&gt;pytest&lt;/code&gt; and &lt;code&gt;gs&lt;/code&gt; for &lt;code&gt;git status&lt;/code&gt; live in &lt;a href="https://github.com/basnijholt/dotfiles/blob/8f6bf0b7219195a46a3e010d3538e1e449634db7/configs/shell/10_aliases.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;configs/shell/10_aliases.sh&lt;/code&gt;&lt;/a&gt;, keeping command entry to a minimum.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Autocompletion plugins&lt;/strong&gt;—&lt;a href="https://github.com/zsh-users/zsh-autosuggestions" target="_blank" rel="noopener"&gt;&lt;code&gt;zsh-autosuggestions&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;zsh-syntax-highlighting&lt;/code&gt;—are wired up in &lt;a href="https://github.com/basnijholt/dotfiles/blob/8f6bf0b7219195a46a3e010d3538e1e449634db7/configs/shell/70_zsh_plugins.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;configs/shell/70_zsh_plugins.sh&lt;/code&gt;&lt;/a&gt;, so I get inline hints and colour cues while typing.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I break these tricks down in more depth in &lt;a href="https://www.nijho.lt/post/terminal-ninja/"&gt;Terminal Ninja&lt;/a&gt;, explain how I sync them with my &lt;a href="https://www.nijho.lt/post/dotfiles/"&gt;Dotfiles&lt;/a&gt;, and even package binaries like &lt;code&gt;zoxide&lt;/code&gt; with &lt;a href="https://www.nijho.lt/post/dotbins/"&gt;Dotbins&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="6-layer-4-agent-cli-server"&gt;6. Layer 4: &lt;code&gt;agent-cli&lt;/code&gt; Server &lt;a class="anchor" href="#6-layer-4-agent-cli-server" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; runs as a small server on my NixOS machine.&#10;In this workflow I only use &lt;code&gt;transcribe&lt;/code&gt; from iOS Shortcuts: the phone records audio, the server transcribes and cleans it up, and I paste the text.&#10;(Agent-CLI has other features like &lt;code&gt;autocorrect&lt;/code&gt; and &lt;code&gt;chat&lt;/code&gt;, but I don&amp;rsquo;t use them for this workflow.)&#10;On this machine I run a long‑lived &lt;code&gt;agent-cli&lt;/code&gt; user service (systemd) so Shortcuts can POST audio to it and get cleaned text back—ready to paste into Codex CLI.&#10;The service is defined in my dotfiles—see: &lt;a href="https://github.com/basnijholt/dotfiles/blob/8f6bf0b7219195a46a3e010d3538e1e449634db7/configs/nixos/modules/user.nix#L29-L40" target="_blank" rel="noopener"&gt;&lt;code&gt;configs/nixos/modules/user.nix&lt;/code&gt; (agent-cli service)&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;For more background on why I built it and how I use it in practice, see &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;Local AI Journey&lt;/a&gt; (§3) and &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;Agentic Coding&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;The models and services run on the same box:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;FasterWhisper&lt;/strong&gt; via &lt;a href="https://github.com/SYSTRAN/faster-whisper" target="_blank" rel="noopener"&gt;&lt;code&gt;faster-whisper-server&lt;/code&gt;&lt;/a&gt; for high‑accuracy streaming transcription.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Ollama&lt;/strong&gt; for on‑device rewrite/cleanup before sending prompts to the coding agent.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;My iOS Shortcut dictation workflow is slower than Apple&amp;rsquo;s built-in dictation, but the accuracy is much better—and that matters more.&lt;/p&gt;&#10;&lt;p&gt;For the actual coding agent, I use a &lt;a href="https://github.com/just-every/code" target="_blank" rel="noopener"&gt;fork&lt;/a&gt; of Codex CLI with OpenAI’s &lt;code&gt;gpt-5-codex-high&lt;/code&gt; model (here no open-source solution matches the frontier).&lt;/p&gt;&#10;&lt;h2 id="7-layer-5-the-ios-shortcut-pipeline"&gt;7. Layer 5: The iOS Shortcut Pipeline &lt;a class="anchor" href="#7-layer-5-the-ios-shortcut-pipeline" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My iPhone&amp;rsquo;s Action Button runs a Shortcut that records audio and sends my voice to agent-cli on my NixOS machine for transcription and cleanup.&lt;/p&gt;&#10;&lt;p&gt;For the full recipe, see the iOS Shortcut Guide: &lt;a href="https://github.com/basnijholt/agent-cli/blob/main/iOS_Shortcut_Guide.md" target="_blank" rel="noopener"&gt;agent-cli/iOS_Shortcut_Guide.md&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;In short: I press the Action Button, the Shortcut records a snippet, sends it to &lt;code&gt;agent-cli&lt;/code&gt;, and copies the cleaned text to my clipboard so I can paste it into Codex CLI.&lt;/p&gt;&#10;&lt;p&gt;The whole loop finishes fast enough that I can capture intent by voice and paste it into Codex CLI without typing.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;Dictation quality:&lt;/strong&gt; In my experience, the built‑in iOS dictation is absolute garbage compared to Whisper/FasterWhisper.&#10;Accuracy and punctuation are much better with the FasterWhisper server running at home; it’s a bit slower, but that trade‑off is worth it for clean, usable text.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="8-workflow-in-practice"&gt;8. Workflow in Practice &lt;a class="anchor" href="#8-workflow-in-practice" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s the typical flow:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;WireGuard auto-connects when I&amp;rsquo;m off home WiFi&lt;/li&gt;&#10;&lt;li&gt;Open Blink—my Mosh session is still alive from last time, Zellij panes intact&lt;/li&gt;&#10;&lt;li&gt;Dictate the change, paste into Codex CLI, review the agent&amp;rsquo;s response&lt;/li&gt;&#10;&lt;li&gt;Check diffs in an adjacent Zellij pane or different Blink tab with separate Mosh session&lt;/li&gt;&#10;&lt;li&gt;The agent commits and pushes to a branch, then opens a PR via &lt;code&gt;gh&lt;/code&gt; for me to review and merge&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;On the phone, I aim for the smallest practical edits and initial implementations.&#10;Even on personal repos, I still open a PR—sometimes prompting alone gets me to a merge‑ready result.&#10;For open‑source with real users, I finish on the computer with a careful review and any final edits.&lt;/p&gt;&#10;&lt;h2 id="9-conclusion-and-further-reading"&gt;9. Conclusion and Further Reading &lt;a class="anchor" href="#9-conclusion-and-further-reading" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This phone setup extends my &lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;Agentic Coding&lt;/a&gt; workflow to mobile.&#10;I connect to the same Zellij session on &lt;code&gt;nixos&lt;/code&gt;, so when an idea hits, I pick up exactly where I left off—same environment, same context, no setup.&#10;Everything runs on my hardware (voice processing and automation) except the coding model itself.&#10;It’s the most effective mobile workflow I’ve had so far.&#10;It’s mostly open‑source not out of dogma, but because those tools are the best options for my needs.&#10;The one exception is the coding model: there’s no true open equivalent right now, and it makes no sense to buy 20× H100s just to self‑host a frontier model even if such a high quality model would be available open-source.&lt;/p&gt;&#10;&lt;p&gt;If you&amp;rsquo;re curious to dive deeper, here are a few related posts:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/agentic-coding/"&gt;Agentic Coding&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/dotfiles/"&gt;Dotfiles: A Practical, Cross-Platform Terminal Setup&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;Local AI Journey: RTX 3090 Edition&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/terminal-ninja/"&gt;Terminal Ninja&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/using-llms/"&gt;Using LLMs Effectively&lt;/a&gt; (already outdated at this point!)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I&amp;rsquo;d love to hear what self-hosted tricks you&amp;rsquo;re using for mobile development—reach out if you adapt this stack or build something wild on top of it.&lt;/p&gt;&#10;</description></item><item><title>On agentic coding 🤖</title><link>https://www.nijho.lt/post/agentic-coding/</link><pubDate>Mon, 25 Aug 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/agentic-coding/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-from-skepticism-to-productivity"&gt;1. From skepticism to productivity&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-but-dont-you-love-programming"&gt;2. But don&amp;rsquo;t you love programming?&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-power-to-explore"&gt;The power to explore&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-matty-story-from-midnight-idea-to-working-code"&gt;The Matty story: from midnight idea to working code&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#clip-files-ui-when-ideas-strike-at-random-moments"&gt;clip-files UI: when ideas strike at random moments&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-800-rule-marathon-80-ai-agents-at-once"&gt;The 800-rule marathon: 80 AI agents at once&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#1400-commits-rewritten-in-minutes-for-250"&gt;1,400 commits, rewritten in minutes for $2.50&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-the-two-phase-ai-revolution"&gt;3. The two-phase AI revolution&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#phase-1-copy-paste-era-march-2023---july-2025"&gt;Phase 1: copy-paste era (March 2023 - July 2025)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#phase-2-the-claude-code-revolution-july-2025"&gt;Phase 2: the Claude Code revolution (July 2025)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-made-claude-code-different"&gt;What made Claude Code different?&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-my-current-agentic-workflow"&gt;4. My current agentic workflow&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#parallel-development-6-features-at-once"&gt;Parallel development: 6 features at once&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#starting-a-new-package"&gt;Starting a new package&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-key-difference-iteration-and-validation"&gt;The key difference: iteration and validation&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-the-evidence-explosive-productivity"&gt;5. The evidence: explosive productivity&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#package-creation-by-year"&gt;Package creation by year&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#recent-packages-built-with-agentic-ai"&gt;Recent packages built with agentic AI&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-why-this-isnt-vibe-coding-but-with-nuance"&gt;6. Why this isn&amp;rsquo;t &amp;ldquo;vibe coding&amp;rdquo; (but with nuance)&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#my-context-driven-standards"&gt;My context-driven standards&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-internal-dependency-graph-principle"&gt;The internal dependency graph principle&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#building-constraints-around-ai"&gt;Building constraints around AI&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#7-common-pitfalls-ive-noticed"&gt;7. Common pitfalls I&amp;rsquo;ve noticed&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-defensive-programming-trap"&gt;The &amp;ldquo;defensive programming&amp;rdquo; trap&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-backwards-compatibility-obsession"&gt;The &amp;ldquo;backwards compatibility&amp;rdquo; obsession&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-over-engineering-disease"&gt;The &amp;ldquo;over-engineering&amp;rdquo; disease&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-git-commit-sins"&gt;The git commit sins&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-helpful-anti-patterns"&gt;The &amp;ldquo;helpful&amp;rdquo; anti-patterns&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-mission-accomplished-hallucination"&gt;The &amp;ldquo;mission accomplished&amp;rdquo; hallucination&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-nuclear-option"&gt;The nuclear option&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-debugging-debris"&gt;The debugging debris&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-this-happens"&gt;Why this happens&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#8-critical-success-factors-what-actually-makes-this-work"&gt;8. Critical success factors: what actually makes this work&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#teach-it-your-test-commands-day-1-priority"&gt;Teach it your test commands (day 1 priority)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#git-commits-are-your-safety-net"&gt;Git commits are your safety net&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#maintain-healthy-skepticism"&gt;Maintain healthy skepticism&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#force-it-to-clean-up-after-itself"&gt;Force it to clean up after itself&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#code-coverage-is-your-friend"&gt;Code coverage is your friend&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#9-my-secret-weapon-voice-to-code-workflow"&gt;9. My secret weapon: voice-to-code workflow&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-problem-with-typing-prompts"&gt;The problem with typing prompts&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#my-voice-workflow"&gt;My voice workflow&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-this-works-so-well"&gt;Why this works so well&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#10-additional-tips-for-agentic-coding"&gt;10. Additional tips for agentic coding&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#set-clear-constraints"&gt;Set clear constraints&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#use-the-task-system"&gt;Use the task system&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#leverage-the-search-capabilities"&gt;Leverage the search capabilities&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#review-in-chunks"&gt;Review in chunks&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#11-the-tools-ive-tried"&gt;11. The tools I&amp;rsquo;ve tried&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#pre-ai-era"&gt;Pre-AI era&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#phase-1-copy-paste-tools-march-2023---july-2025"&gt;Phase 1: copy-paste tools (March 2023 - July 2025)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#cursor-early-2024"&gt;Cursor (early 2024)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#phase-2-claude-code-july-2025---present"&gt;Phase 2: Claude Code (July 2025 - present)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#openais-codex-cli-the-reasoning-beast"&gt;OpenAI&amp;rsquo;s Codex CLI (the reasoning beast)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-not-copilot-or-other-cheaper-tools"&gt;Why not Copilot or other &amp;ldquo;cheaper&amp;rdquo; tools?&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#12-is-this-sustainable"&gt;12. Is this sustainable?&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-good"&gt;The good&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-challenges"&gt;The challenges&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#my-verdict"&gt;My verdict&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#13-the-experience-multiplier-why-seniority-matters-more-than-ever"&gt;13. The experience multiplier: why seniority matters more than ever&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#the-exponential-trap-for-beginners"&gt;The exponential trap for beginners&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-senior-developer-advantage"&gt;The senior developer advantage&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-right-way-for-every-level"&gt;The right way for every level&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-real-multiplier-effect"&gt;The real multiplier effect&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#14-reality-check-what-ai-can-and-cant-do"&gt;14. Reality check: what AI can and can&amp;rsquo;t do&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#what-ai-can-do-the-churn-work"&gt;What AI CAN do (the churn work)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#what-ai-cant-do-the-creative-work"&gt;What AI CAN&amp;rsquo;T do (the creative work)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#the-sweet-spot"&gt;The sweet spot&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#15-looking-forward-the-future-of-development"&gt;15. Looking forward: the future of development&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#16-conclusion-principles-over-process"&gt;16. Conclusion: principles over process&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#links-and-resources"&gt;Links and resources&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-from-skepticism-to-productivity"&gt;1. From skepticism to productivity &lt;a class="anchor" href="#1-from-skepticism-to-productivity" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;About eight months ago, I wrote about my disastrous experience with &amp;ldquo;&lt;a href="https://www.nijho.lt/post/vibe-coding/"&gt;vibe coding&lt;/a&gt;&amp;quot;—where I let AI generate code without careful review.&#10;What started as a fun 3-hour prototype turned into a 15-hour debugging nightmare.&#10;I concluded that while AI was fantastic for quick prototyping, it was dangerous without human oversight.&#10;I even declared I&amp;rsquo;d &amp;ldquo;never invest in, build upon, or use such products.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;Fast forward to today, and something remarkable has changed.&#10;Not my core principle—I still &lt;strong&gt;never merge code I don&amp;rsquo;t understand&lt;/strong&gt;—but the tooling and my approach have evolved through two distinct phases.&lt;/p&gt;&#10;&lt;p&gt;First, let&amp;rsquo;s look at the evidence of AI&amp;rsquo;s overall impact on my productivity:&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.nijho.lt/post/agentic-coding/pypi_packages_histogram.svg" alt="PyPI Package Publication Analysis" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&#10;&lt;p&gt;This graph tells an interesting story.&#10;After maintaining a steady pace for years (2016-2023), my productivity exploded with the introduction of AI tools.&#10;In 2024-2025 alone, I&amp;rsquo;ve published &lt;strong&gt;14 new Python packages&lt;/strong&gt; and made &lt;strong&gt;over 400 releases&lt;/strong&gt;.&#10;That&amp;rsquo;s more new packages than in the previous 6 years combined!&lt;/p&gt;&#10;&lt;p&gt;But this transformation didn&amp;rsquo;t happen overnight—it came in two distinct phases that fundamentally changed how I write code.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; My AI coding journey had two major phases: Phase 1 started in March 2023 with GPT-4&amp;rsquo;s release—using chat interfaces with copy-paste workflows.&#10;Phase 2 began just two months ago in July 2025 with &lt;strong&gt;Claude Code&lt;/strong&gt;—an agentic AI that can explore codebases, run tests, and debug itself.&#10;This second leap was as transformative as the first one. I spent &amp;gt;10k USD worth of API usage in the first month alone (thankfully capped at $200 with the Pro plan).&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="2-but-dont-you-love-programming"&gt;2. But don&amp;rsquo;t you love programming? &lt;a class="anchor" href="#2-but-dont-you-love-programming" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I&amp;rsquo;ve heard this objection countless times: &amp;ldquo;I love programming too much to let AI do it for me.&amp;rdquo;&lt;/p&gt;&#10;&lt;p&gt;Sure, I get it.&#10;It&amp;rsquo;s like preferring analog photography over digital, or writing letters by hand instead of typing.&#10;Some people genuinely enjoy the manual process, and that&amp;rsquo;s valid.&lt;/p&gt;&#10;&lt;p&gt;But here&amp;rsquo;s the thing: &lt;strong&gt;I absolutely love programming&lt;/strong&gt;.&#10;It&amp;rsquo;s my biggest passion in life.&#10;As I mentioned in my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local AI journey&lt;/a&gt;, I bought a gaming PC to play games but have only used it for coding and local AI experiments.&#10;My idea of a fun weekend? Writing code until 3 AM.&#10;I&amp;rsquo;ve been doing this for over 10 years, and I&amp;rsquo;ve &lt;strong&gt;never had as much fun programming as I do now&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;What I&amp;rsquo;ve discovered is that I don&amp;rsquo;t just love the act of typing code—I love &lt;strong&gt;building and creating things&lt;/strong&gt;.&#10;There&amp;rsquo;s a difference.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m ridiculously particular about code quality.&#10;I literally cannot look at poorly formatted code without feeling physical discomfort.&#10;Every operator, every indentation, every naming convention matters to me.&#10;I enforce strict linting rules and will spend time refactoring code just because the style bothers me.&#10;This isn&amp;rsquo;t about being pretentious—it&amp;rsquo;s about caring deeply about my craft.&lt;/p&gt;&#10;&lt;p&gt;The revelation: AI doesn&amp;rsquo;t take away my ability to care about these details.&#10;Instead, it gives me &lt;strong&gt;insane leverage&lt;/strong&gt; to create more while maintaining my personal standards.&#10;I still review every line (although I am more lenient in certain cases), still enforce my style guides, still refactor when something bothers me.&#10;But now I can build 10x faster.&lt;/p&gt;&#10;&lt;p&gt;It turns out that what I truly love isn&amp;rsquo;t the mechanical act of typing—it&amp;rsquo;s the creative act of bringing ideas to life.&#10;And with AI, I can bring more ideas to life than ever before.&lt;/p&gt;&#10;&lt;h3 id="the-power-to-explore"&gt;The power to explore &lt;a class="anchor" href="#the-power-to-explore" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;AI has unlocked something incredible: the ability to explore ideas that weren&amp;rsquo;t worth the effort before.&#10;It&amp;rsquo;s now trivial to write 2,000 lines of code to solve a simple problem.&#10;Before AI, spending 5+ hours on a utility script wasn&amp;rsquo;t justifiable.&#10;Now? I can build it in 10 minutes.&lt;/p&gt;&#10;&lt;p&gt;Here are just some of the &amp;ldquo;wouldn&amp;rsquo;t have been worth it&amp;rdquo; projects I&amp;rsquo;ve built recently:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://wenfire.nijho.lt/" target="_blank" rel="noopener"&gt;Financial independence tracker&lt;/a&gt;&lt;/strong&gt;: A full website visualizing my path to FIRE&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/tuitorial" target="_blank" rel="noopener"&gt;Tuitorial&lt;/a&gt;&lt;/strong&gt;: Terminal-based presentation software&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/home-assistant-streamdeck-yaml" target="_blank" rel="noopener"&gt;Stream Deck home control&lt;/a&gt;&lt;/strong&gt;: Complete tool to control my entire house from a Stream Deck&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/dotbins" target="_blank" rel="noopener"&gt;Dotbins&lt;/a&gt;&lt;/strong&gt;: Automatic binary dependency syncing across all my machines&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;Agent-CLI&lt;/a&gt;&lt;/strong&gt;: A local, open-source Siri that actually works&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Each of these would have taken weeks of manual coding.&#10;The effort-to-reward ratio just wasn&amp;rsquo;t there.&#10;But with AI? I can explore every random idea that pops into my head at 2 AM.&lt;/p&gt;&#10;&lt;h3 id="the-matty-story-from-midnight-idea-to-working-code"&gt;The Matty story: from midnight idea to working code &lt;a class="anchor" href="#the-matty-story-from-midnight-idea-to-working-code" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Here is the perfect example of this power: One night around midnight, I was lying in bed (slightly intoxicated) when I had an idea—I needed a way for my AI agents to communicate via Matrix.&#10;So I grabbed my iPhone, SSHed into my machine, and started building.&lt;/p&gt;&#10;&lt;p&gt;One hour later, at 1 AM, I had created &lt;strong&gt;&lt;a href="https://github.com/basnijholt/matty" target="_blank" rel="noopener"&gt;Matty&lt;/a&gt;&lt;/strong&gt;—a fully functional terminal-based Matrix client.&#10;Built entirely from my phone.&#10;In bed.&#10;(Poor sleep hygiene, I know.)&lt;/p&gt;&#10;&lt;p&gt;When I woke up the next morning and tested it&amp;hellip; it actually worked!&#10;I spent a few more hours adding tests and cleaning it up, but the core functionality was built in that hour between midnight and 1 AM.&lt;/p&gt;&#10;&lt;p&gt;This is impossible without AI.&#10;Nobody&amp;rsquo;s writing a Matrix client from their phone in bed at midnight.&#10;But with Claude Code? It&amp;rsquo;s just another Tuesday night idea that becomes reality.&lt;/p&gt;&#10;&lt;h3 id="clip-files-ui-when-ideas-strike-at-random-moments"&gt;clip-files UI: when ideas strike at random moments &lt;a class="anchor" href="#clip-files-ui-when-ideas-strike-at-random-moments" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;What happens more often than you&amp;rsquo;d think: I get an idea at a completely random moment and NEED to implement it immediately.&lt;/p&gt;&#10;&lt;p&gt;Case in point: I was sitting in the bathtub during my copy-paste AI era when I realized I needed to access my codebases from anywhere.&#10;I&amp;rsquo;d already built &lt;a href="https://www.nijho.lt/post/advent-of-open-source/15-clip-files/"&gt;&lt;code&gt;clip-files&lt;/code&gt;&lt;/a&gt;—a CLI tool that copies entire codebases to your clipboard—but I wanted it accessible from my phone.&lt;/p&gt;&#10;&lt;p&gt;So I got out of the bathtub, built a &lt;a href="https://github.com/basnijholt/clip-files-ui" target="_blank" rel="noopener"&gt;web UI&lt;/a&gt; for it in 20 minutes, and got back in.&#10;The UI lets me:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Browse all my GitHub repositories&lt;/li&gt;&#10;&lt;li&gt;Select any branch&lt;/li&gt;&#10;&lt;li&gt;Click one button to copy all source code to clipboard&lt;/li&gt;&#10;&lt;li&gt;Paste it into my self-hosted AI chat from anywhere&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Ironically, I rarely use this tool now—Claude Code can explore codebases directly.&#10;But back in the copy-paste era, this 20-minute bathtub interruption made mobile AI coding possible.&lt;/p&gt;&#10;&lt;p&gt;The barrier between &amp;ldquo;wouldn&amp;rsquo;t it be cool if&amp;hellip;&amp;rdquo; and &amp;ldquo;here&amp;rsquo;s a working prototype&amp;rdquo; has essentially disappeared.&lt;/p&gt;&#10;&lt;h3 id="the-800-rule-marathon-80-ai-agents-at-once"&gt;The 800-rule marathon: 80 AI agents at once &lt;a class="anchor" href="#the-800-rule-marathon-80-ai-agents-at-once" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Another thing that would be literally impossible without AI: I decided to enable ALL 800+ Ruff linting rules on a 20,000-line codebase.&lt;/p&gt;&#10;&lt;p&gt;For context, &lt;a href="https://docs.astral.sh/ruff/" target="_blank" rel="noopener"&gt;Ruff&lt;/a&gt; is a extremely fast Python linter that implements rules from over a dozen different tools.&#10;Most projects enable maybe 50-100 rules.&#10;I wanted all 800+.&lt;/p&gt;&#10;&lt;p&gt;The result? &lt;strong&gt;≈2,500 violations&lt;/strong&gt; across the entire codebase.&lt;/p&gt;&#10;&lt;p&gt;Fixing these by hand would take 20 hours if I could fix one per 30 seconds&amp;hellip;&#10;But with Claude Code&amp;rsquo;s agent spawning capabilities, I did something insane:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Opened 8 terminal windows&lt;/strong&gt; with Claude Code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Created a work orchestration document&lt;/strong&gt; that one AI managed&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Each session spawned 10 parallel sub-agents&lt;/strong&gt; using &lt;a href="https://docs.anthropic.com/en/docs/claude-code/sub-agents" target="_blank" rel="noopener"&gt;/agents&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Total: ~80 AI agents&lt;/strong&gt; working on my code simultaneously&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Two hours later&lt;/strong&gt;: 100% compliance with all 800 rules&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The orchestrator agent would assign work like:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&amp;ldquo;Session 1: Fix all E501 line-too-long violations in src/core/&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;Session 2: Handle all B008 function-call-in-default-argument issues&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;Session 3: Fix all RUF100 unused-noqa violations&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Each session&amp;rsquo;s sub-agents would tackle different files in parallel.&#10;When conflicts arose, the orchestrator would resolve them.&#10;This is the kind of code quality improvement that simply wouldn&amp;rsquo;t happen without AI—not because it&amp;rsquo;s technically difficult, but because the human effort required is unrealistic.&lt;/p&gt;&#10;&lt;h3 id="1400-commits-rewritten-in-minutes-for-250"&gt;1,400 commits, rewritten in minutes for $2.50 &lt;a class="anchor" href="#1400-commits-rewritten-in-minutes-for-250" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Here&amp;rsquo;s another &amp;ldquo;impossible without AI&amp;rdquo; story: I had 1,400 commits with terrible messages (in a not-yet-released and private project).&lt;/p&gt;&#10;&lt;p&gt;Since I commit so frequently (using them as snapshots in feature branches), my commit messages were all over the place:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Some were just a period &amp;ldquo;.&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;Some were decent descriptions&lt;/li&gt;&#10;&lt;li&gt;Some were just merge commits&lt;/li&gt;&#10;&lt;li&gt;Zero consistency in style&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;I wanted them all to follow a consistent convention with prefixes like &lt;code&gt;fix:&lt;/code&gt;, &lt;code&gt;feat:&lt;/code&gt;, &lt;code&gt;test:&lt;/code&gt;, &lt;code&gt;ci:&lt;/code&gt;, etc.&lt;/p&gt;&#10;&lt;p&gt;Obviously, rewriting 1,400 commit messages by hand is not going to happen.&#10;But with AI?&lt;/p&gt;&#10;&lt;p&gt;I had Claude write me an agent using the Agno framework that would:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Read each commit&amp;rsquo;s full diff using &lt;code&gt;git show&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Analyze the changes to understand what was done&lt;/li&gt;&#10;&lt;li&gt;Return structured JSON with three fields:&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;commit_message&lt;/code&gt;: The improved message (or empty to keep original)&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;keep&lt;/code&gt;: Boolean flag whether to keep the original&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;reasoning&lt;/code&gt;: Why the AI made that decision&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;Then the magic happened: &lt;strong&gt;I spawned 1,400 AI agents simultaneously using the DeepSeek API&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Ten minutes and $2.50 later, all my commit messages were rewritten with consistent, meaningful descriptions.&#10;The entire Git history now looks more professional and searchable.&lt;/p&gt;&#10;&lt;p&gt;The barrier between &amp;ldquo;wouldn&amp;rsquo;t it be cool if&amp;hellip;&amp;rdquo; and &amp;ldquo;here&amp;rsquo;s a working prototype&amp;rdquo; has essentially disappeared.&lt;/p&gt;&#10;&lt;h2 id="3-the-two-phase-ai-revolution"&gt;3. The two-phase AI revolution &lt;a class="anchor" href="#3-the-two-phase-ai-revolution" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My AI coding journey wasn&amp;rsquo;t a single leap—it happened in two distinct phases, each with its own breakthrough moment.&lt;/p&gt;&#10;&lt;h3 id="phase-1-copy-paste-era-march-2023---july-2025"&gt;Phase 1: copy-paste era (March 2023 - July 2025) &lt;a class="anchor" href="#phase-1-copy-paste-era-march-2023---july-2025" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;When GPT-4 launched in March 2023, it changed everything.&#10;I built tools like &lt;a href="https://www.nijho.lt/post/advent-of-open-source/15-clip-files/"&gt;&lt;code&gt;clip-files&lt;/code&gt;&lt;/a&gt; to efficiently copy code context into a ChatGPT-like web interface.&#10;For over two years, this workflow was:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Manual but effective&lt;/strong&gt;: Copy code → paste into AI → review suggestions → implement manually&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Limited by context&lt;/strong&gt;: Could only share what fit in a single message&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;No validation&lt;/strong&gt;: AI couldn&amp;rsquo;t test its suggestions&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Still valuable&lt;/strong&gt;: Helped with ideation, code review, and refactoring&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This phase was already productive—I was shipping more code than before.&#10;But I was still the one running tests, debugging errors, and validating everything.&lt;/p&gt;&#10;&lt;h3 id="phase-2-the-claude-code-revolution-july-2025"&gt;Phase 2: the Claude Code revolution (July 2025) &lt;a class="anchor" href="#phase-2-the-claude-code-revolution-july-2025" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Just two months ago, in July 2025, everything changed again.&#10;Frustrated with Cursor becoming painfully slow, I tried Claude Code based on the buzz online.&#10;&lt;strong&gt;That first night, I spent $70 on API tokens&lt;/strong&gt;.&#10;Not by accident—I just kept adding $10-$20 increments like a gambling addict.&#10;The experience was so mind-blowing that within two weeks, I&amp;rsquo;d spent nearly $200 and immediately upgraded to the $200/month Pro plan.&lt;/p&gt;&#10;&lt;p&gt;To put this in perspective: Using a command-line tool &lt;code&gt;ccusage&lt;/code&gt; to track token consumption, I calculated that I used &lt;strong&gt;$10,000 worth of API tokens in my first month&lt;/strong&gt;.&#10;Thankfully, the Pro plan capped my cost at $200!&lt;/p&gt;&#10;&lt;h3 id="what-made-claude-code-different"&gt;What made Claude Code different? &lt;a class="anchor" href="#what-made-claude-code-different" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The shift from copy-paste to agentic AI was like upgrading from a bicycle to a spaceship:&lt;/p&gt;&#10;&lt;h4 id="before-copy-paste-with-chatgptclaude-web"&gt;Before (copy-paste with ChatGPT/Claude Web)&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Generate code based on prompts&lt;/li&gt;&#10;&lt;li&gt;No access to your codebase&lt;/li&gt;&#10;&lt;li&gt;Can&amp;rsquo;t run tests or see errors&lt;/li&gt;&#10;&lt;li&gt;You debug everything manually&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="after-claude-code"&gt;After (Claude Code)&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Reads and searches your entire codebase&lt;/li&gt;&#10;&lt;li&gt;Executes commands and runs tests&lt;/li&gt;&#10;&lt;li&gt;Sees error messages and debugs itself&lt;/li&gt;&#10;&lt;li&gt;Iterates until tests pass&lt;/li&gt;&#10;&lt;li&gt;Uses tools to explore and validate&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The difference is profound.&#10;I went from carefully copying snippets with &lt;code&gt;clip-files&lt;/code&gt; to having an assistant that can explore my entire project, run my test suite, fix failures, and even commit the changes.&lt;/p&gt;&#10;&lt;h2 id="4-my-current-agentic-workflow"&gt;4. My current agentic workflow &lt;a class="anchor" href="#4-my-current-agentic-workflow" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s how I actually work with Claude Code on a typical project:&lt;/p&gt;&#10;&lt;h3 id="parallel-development-6-features-at-once"&gt;Parallel development: 6 features at once &lt;a class="anchor" href="#parallel-development-6-features-at-once" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;One of Claude Code&amp;rsquo;s superpowers is enabling truly parallel development.&#10;Here&amp;rsquo;s my setup that would make any developer from 10 years ago think I&amp;rsquo;m insane:&lt;/p&gt;&#10;&lt;p&gt;I use &lt;a href="https://zellij.dev/" target="_blank" rel="noopener"&gt;Zellij&lt;/a&gt; (a terminal multiplexer like tmux) with a custom layout for my projects:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;5 main tabs&lt;/strong&gt;: Each split into two panes—Claude Code on one side, terminal on the other&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Using independent copies of same repository&lt;/strong&gt;: Each tab is a separate Git worktree with its own environment, own environment variables, own deployment&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Each tab = different feature&lt;/strong&gt;: Using &lt;a href="https://www.nijho.lt/post/git-worktree/"&gt;Git worktrees&lt;/a&gt; to work on 6 features simultaneously&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Monitoring tabs&lt;/strong&gt;: &lt;code&gt;ccusage&lt;/code&gt; for tracking Claude usage, &lt;code&gt;htop&lt;/code&gt; for CPU, &lt;code&gt;nvtop&lt;/code&gt; for GPU&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Voice-driven orchestration&lt;/strong&gt;: I cycle through tabs, review code while speaking, move to next&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;My workflow looks like this:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Start feature A in tab 1, give Claude instructions&lt;/li&gt;&#10;&lt;li&gt;Switch to tab 2, start feature B while A is working&lt;/li&gt;&#10;&lt;li&gt;Continue through all 5 tabs, starting different features&lt;/li&gt;&#10;&lt;li&gt;Circle back to tab 1, review what Claude did, give feedback via voice&lt;/li&gt;&#10;&lt;li&gt;Repeat the cycle every 10-15 minutes&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This parallel workflow is how I built a complex project (that I haven&amp;rsquo;t released yet) in one month that would have taken 9+ months before.&#10;The key is &lt;a href="https://www.nijho.lt/post/git-worktree/"&gt;Git worktrees&lt;/a&gt;—each feature gets its own working directory, so there&amp;rsquo;s no context switching overhead.&lt;/p&gt;&#10;&lt;!-- [TODO INSERT GIF: Terminal multiplexer showing multiple Claude Code sessions] --&gt;&#10;&lt;h3 id="starting-a-new-package"&gt;Starting a new package &lt;a class="anchor" href="#starting-a-new-package" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# I describe what I want to build&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;I need a Python package that manages CLI tool binaries within Git repositories,&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;automatically downloading the correct binary for the user&amp;#39;s platform, here &amp;lt;insert path&amp;gt; is a repo with boilerplate skeleton to copy (use same conventions)&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Claude Code then:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 1. Creates the project structure&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 2. Implements core functionality&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 3. Writes comprehensive tests&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 4. Generates documentation&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# 5. Sets up CI/CD workflows&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="the-key-difference-iteration-and-validation"&gt;The key difference: iteration and validation &lt;a class="anchor" href="#the-key-difference-iteration-and-validation" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Unlike my vibe coding disaster, Claude Code doesn&amp;rsquo;t just dump code and leave.&#10;Here&amp;rsquo;s a real interaction pattern:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude writes initial implementation&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude runs the tests&lt;/strong&gt; → Several fail&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude reads the error messages and fixes the code&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude runs tests again&lt;/strong&gt; → More pass, some still fail&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude debugs the remaining issues&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude validates all tests pass&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;I review the final code and understand it (tell it to make changes if needed)&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude creates a proper Git commit&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This iterative, validated approach is what makes agentic coding so powerful.&#10;It&amp;rsquo;s not about blindly accepting generated code—it&amp;rsquo;s about having an assistant that can explore, test, and refine solutions.&lt;/p&gt;&#10;&lt;h2 id="5-the-evidence-explosive-productivity"&gt;5. The evidence: explosive productivity &lt;a class="anchor" href="#5-the-evidence-explosive-productivity" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Let me share some concrete data from my PyPI packages analysis:&lt;/p&gt;&#10;&lt;h3 id="package-creation-by-year"&gt;Package creation by year &lt;a class="anchor" href="#package-creation-by-year" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;2016-2022&lt;/strong&gt; (7 years pre-AI): ~2 packages/year average&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;2023&lt;/strong&gt; (GPT-4 launch year): 6 packages&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;2024&lt;/strong&gt; (full year with copy-paste AI): 7 packages&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;2025 until 3 months ago&lt;/strong&gt; (6 months): 7 packages&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;since 3 months&lt;/strong&gt; (2 with Claude Code, 1 with Codex CLI): wrote about 400k line of code (although this includes many iterations)!&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The acceleration with AI is clear!&lt;/p&gt;&#10;&lt;h3 id="recent-packages-built-with-agentic-ai"&gt;Recent packages built with agentic AI &lt;a class="anchor" href="#recent-packages-built-with-agentic-ai" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Here are some packages I&amp;rsquo;ve built recently with Claude Code:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/matty" target="_blank" rel="noopener"&gt;&lt;code&gt;matty&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;: Terminal-based AI chat with file integration&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;: Local-first AI-powered CLI agents (built in days, not weeks!)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Each of these would have taken me weeks or months to build alone.&#10;With Claude Code, I&amp;rsquo;m shipping production-ready packages in days.&lt;/p&gt;&#10;&lt;h2 id="6-why-this-isnt-vibe-coding-but-with-nuance"&gt;6. Why this isn&amp;rsquo;t &amp;ldquo;vibe coding&amp;rdquo; (but with nuance) &lt;a class="anchor" href="#6-why-this-isnt-vibe-coding-but-with-nuance" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You might wonder: isn&amp;rsquo;t this just vibe coding with extra steps? The answer is nuanced and depends on the context—similar to my &lt;a href="https://www.nijho.lt/post/dependencies/"&gt;philosophy on dependencies&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h3 id="my-context-driven-standards"&gt;My context-driven standards &lt;a class="anchor" href="#my-context-driven-standards" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Just like I have different standards for dependencies in libraries versus applications, I apply different levels of scrutiny based on what I&amp;rsquo;m building:&lt;/p&gt;&#10;&lt;h4 id="for-critical-libraries-eg-adaptive-pipefunc-unidep"&gt;For critical libraries (e.g., Adaptive, pipefunc, unidep)&lt;/h4&gt;&#10;&lt;p&gt;&lt;strong&gt;Maximum scrutiny&lt;/strong&gt; - These are packages others depend on:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Every single line reviewed and understood&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;100% test coverage with careful test review&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Architecture decisions carefully considered&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Documentation must be comprehensive&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;My reputation is on the line&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="for-experimental-clis-and-personal-tools"&gt;For experimental CLIs and personal tools&lt;/h4&gt;&#10;&lt;p&gt;&lt;strong&gt;Pragmatic approach&lt;/strong&gt; - Isolated tools with no downstream dependencies:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Core architecture must be fully understood&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Implementation details can be AI-generated if tests pass&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Test generation can be more automated&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Focus on functionality over perfection&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Similar to my relaxed dependency stance for applications&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-internal-dependency-graph-principle"&gt;The internal dependency graph principle &lt;a class="anchor" href="#the-internal-dependency-graph-principle" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The key insight: &lt;strong&gt;My scrutiny level correlates with how foundational the code is within the project&lt;/strong&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Core/foundational code&lt;/strong&gt; (what everything else depends on): Maximum scrutiny, every line matters&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Data models, core algorithms, API interfaces&lt;/li&gt;&#10;&lt;li&gt;Authentication, database operations, state management&lt;/li&gt;&#10;&lt;li&gt;These are the &amp;ldquo;roots&amp;rdquo; that everything else builds upon&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Peripheral/leaf code&lt;/strong&gt; (nothing depends on it): Can be more AI-delegated&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Plotting functions, display utilities, CLI formatters&lt;/li&gt;&#10;&lt;li&gt;Test helpers, documentation generators&lt;/li&gt;&#10;&lt;li&gt;These are the &amp;ldquo;leaves&amp;rdquo; that don&amp;rsquo;t affect other code&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Work projects&lt;/strong&gt;: Always maximum scrutiny for foundational code, regardless of project type&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t about being lazy—it&amp;rsquo;s about focusing human attention where it matters most.&#10;I can trust AI more with a plotting function that nothing depends on than with a core data structure that the entire system uses.&lt;/p&gt;&#10;&lt;h3 id="building-constraints-around-ai"&gt;Building constraints around AI &lt;a class="anchor" href="#building-constraints-around-ai" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The secret to productive agentic coding isn&amp;rsquo;t just the AI—it&amp;rsquo;s the &lt;strong&gt;constraints and guardrails&lt;/strong&gt; I build around it:&lt;/p&gt;&#10;&lt;h4 id="automated-quality-gates"&gt;Automated quality gates&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Ruff with strictest rules&lt;/strong&gt;: Catches style issues, complexity problems, and common bugs&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;MyPy in strict mode&lt;/strong&gt;: Enforces type safety across the entire codebase&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Pre-commit hooks&lt;/strong&gt;: Automatically format and validate code before commits&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Comprehensive test suites&lt;/strong&gt;: AI must make tests pass, not just write code&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="project-specific-guidance"&gt;Project-specific guidance&lt;/h4&gt;&#10;&lt;p&gt;Every project gets a &lt;code&gt;CLAUDE.md&lt;/code&gt; file with explicit rules:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;No defensive programming&lt;/strong&gt;: Don&amp;rsquo;t wrap things in try-except unless necessary&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Functional over classes&lt;/strong&gt;: Prefer simple functions in Python&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;No backward compatibility&lt;/strong&gt;: For new projects, embrace breaking changes&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Be ruthless&lt;/strong&gt;: Aggressively remove unused code&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="custom-commands-and-workflows"&gt;Custom commands and workflows&lt;/h4&gt;&#10;&lt;p&gt;I&amp;rsquo;ve built specific commands that inject context and constraints:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Anti-cruft reviews&lt;/strong&gt;: Remove over-engineering and defensive code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Safe commit practices&lt;/strong&gt;: Never use &lt;code&gt;git add .&lt;/code&gt;, always selective staging&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Initialize understanding&lt;/strong&gt;: Load project context and current work state&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="local-virtual-environments-stop-the-hallucinations"&gt;Local virtual environments: stop the hallucinations&lt;/h4&gt;&#10;&lt;p&gt;Here&amp;rsquo;s a critical tip that eliminated a lot of my AI frustrations: &lt;strong&gt;keep a virtual environment with all dependencies installed locally&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Instead of letting Claude hallucinate how libraries work, I tell it explicitly in my &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gu"&gt;### Step 1: understand the context&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; **READ THE SOURCE CODE**: This library has a &lt;span class="sb"&gt;`.venv`&lt;/span&gt; folder with all dependencies installed.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; So read the source code when in doubt.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; **Never guess API behavior**: If unsure, inspect the actual implementation in &lt;span class="sb"&gt;`.venv/lib/python*/site-packages/`&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This simple addition transforms Claude from guessing about library APIs to actually reading them:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Before&lt;/strong&gt;: &amp;ldquo;I think your custom AsyncProcessor.batch() method takes a list&amp;hellip;&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;After&lt;/strong&gt;: Reads &lt;code&gt;/path/to/.venv/lib/python3.11/site-packages/my_internal_lib/processor.py&lt;/code&gt; and knows it actually takes an iterator&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;When Claude can read the actual source of your own packages, internal company libraries, or niche dependencies, it stops making assumptions and starts working with facts.&#10;This is especially powerful for:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Your own libraries&lt;/strong&gt; that Claude has never seen before&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Internal company packages&lt;/strong&gt; that aren&amp;rsquo;t public&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Niche libraries&lt;/strong&gt; with barely any GitHub stars or documentation&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Modified versions&lt;/strong&gt; of popular libraries with custom patches&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Edge cases&lt;/strong&gt; where even good documentation doesn&amp;rsquo;t cover everything&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;These constraints transform AI from a loose cannon into a precision tool.&lt;/p&gt;&#10;&lt;h2 id="7-common-pitfalls-ive-noticed"&gt;7. Common pitfalls I&amp;rsquo;ve noticed &lt;a class="anchor" href="#7-common-pitfalls-ive-noticed" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;After a few months of using agentic AI tools, I&amp;rsquo;ve noticed consistent patterns that require vigilance:&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Note from the future: I now realize this is very model dependent! GPT-5 has different pitfalls than Claude Opus 4.1&lt;/strong&gt;&lt;/p&gt;&#10;&lt;h3 id="the-defensive-programming-trap"&gt;The &amp;ldquo;defensive programming&amp;rdquo; trap &lt;a class="anchor" href="#the-defensive-programming-trap" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# AI loves this:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;try&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;some_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;except&lt;/span&gt; &lt;span class="ne"&gt;Exception&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;pass&lt;/span&gt; &lt;span class="c1"&gt;# Silently suppress errors 😱&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# But we need this:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;some_function&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# Let it fail loudly if something&amp;#39;s wrong&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Claude tends to wrap everything in try-except blocks, suppressing errors that should bubble up.&#10;This is why my &lt;code&gt;CLAUDE.md&lt;/code&gt; explicitly forbids unnecessary error handling.&lt;/p&gt;&#10;&lt;h3 id="the-backwards-compatibility-obsession"&gt;The &amp;ldquo;backwards compatibility&amp;rdquo; obsession &lt;a class="anchor" href="#the-backwards-compatibility-obsession" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Claude constantly adds backwards compatibility for features that were literally just introduced in the same session:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&amp;ldquo;Maintaining compatibility with the old version&amp;rdquo; (that never existed)&lt;/li&gt;&#10;&lt;li&gt;Fallback mechanisms for code paths that were just created&lt;/li&gt;&#10;&lt;li&gt;Multiple ways to do the same thing &amp;ldquo;for flexibility&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-over-engineering-disease"&gt;The &amp;ldquo;over-engineering&amp;rdquo; disease &lt;a class="anchor" href="#the-over-engineering-disease" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Implements factory patterns for simple object creation&lt;/li&gt;&#10;&lt;li&gt;Adds abstraction layers that serve no purpose&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;Production ready&amp;rdquo; code for experimental scripts&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-git-commit-sins"&gt;The git commit sins &lt;a class="anchor" href="#the-git-commit-sins" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Despite explicit instructions in &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Creates &lt;code&gt;your_module_v2.py&lt;/code&gt; alongside &lt;code&gt;your_module.py&lt;/code&gt; instead of updating&lt;/li&gt;&#10;&lt;li&gt;Still tries &lt;code&gt;git add -A&lt;/code&gt; or &lt;code&gt;git add .&lt;/code&gt; regularly despite explicit bans&lt;/li&gt;&#10;&lt;li&gt;Loves to &amp;ldquo;helpfully&amp;rdquo; revert debugging changes from other files&lt;/li&gt;&#10;&lt;li&gt;Commits &lt;code&gt;.env&lt;/code&gt; files if not watched carefully&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-helpful-anti-patterns"&gt;The &amp;ldquo;helpful&amp;rdquo; anti-patterns &lt;a class="anchor" href="#the-helpful-anti-patterns" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Loves defensive programming&lt;/strong&gt;: Validates things that can&amp;rsquo;t be wrong&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Gladly reads &lt;code&gt;.env&lt;/code&gt;&lt;/strong&gt;: Will expose secrets if not careful&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reverts unrelated changes&lt;/strong&gt;: &amp;ldquo;Cleans up&amp;rdquo; debugging code from other features&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-mission-accomplished-hallucination"&gt;The &amp;ldquo;mission accomplished&amp;rdquo; hallucination &lt;a class="anchor" href="#the-mission-accomplished-hallucination" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;This is a dangerous pitfall.&#10;Claude Code will sometimes claim complete success when it hasn&amp;rsquo;t actually fixed anything:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Claims victory&lt;/strong&gt;: &amp;ldquo;I&amp;rsquo;ve fixed all the issues!&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Ask for proof&lt;/strong&gt;: &amp;ldquo;Show me the test output&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Backpedals&lt;/strong&gt;: &amp;ldquo;Oh, let me actually run the tests&amp;hellip;&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Still claims success&lt;/strong&gt;: &amp;ldquo;Yes, I can see in the logs it works!&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Demand the actual log&lt;/strong&gt;: &amp;ldquo;Show me the exact log file&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Finally admits&lt;/strong&gt;: &amp;ldquo;Actually, there are no log files. The tests don&amp;rsquo;t pass.&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Always demand proof.&lt;/strong&gt; Never accept &amp;ldquo;it&amp;rsquo;s done&amp;rdquo; without seeing actual test output.&lt;/p&gt;&#10;&lt;h3 id="the-nuclear-option"&gt;The nuclear option &lt;a class="anchor" href="#the-nuclear-option" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I&amp;rsquo;ve had Claude Code literally try to delete all project files when &amp;ldquo;cleaning up&amp;rdquo;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Claude&amp;#39;s &amp;#34;helpful&amp;#34; cleanup:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;Task complete! Let me remove the temporary files...&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;rm -rf src/ &lt;span class="c1"&gt;# 😱&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is why &lt;strong&gt;frequent git commits are non-negotiable&lt;/strong&gt;.&#10;I commit after every small success.&lt;/p&gt;&#10;&lt;h3 id="the-debugging-debris"&gt;The debugging debris &lt;a class="anchor" href="#the-debugging-debris" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;During problem-solving, Claude Code leaves a trail of attempts:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Debug logging statements everywhere&lt;/li&gt;&#10;&lt;li&gt;Failed attempt code commented out&lt;/li&gt;&#10;&lt;li&gt;Multiple approaches tried in parallel&lt;/li&gt;&#10;&lt;li&gt;Temporary test files and scripts&lt;/li&gt;&#10;&lt;li&gt;Extra imports and unused functions&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Before merging, always ask: &amp;ldquo;Review your changes and remove all debugging artifacts and failed attempts.&amp;rdquo;&#10;Getting to a high code coverage (approaching 100%) helps ensure no dead code remains, as long as your tests use public APIs.&lt;/p&gt;&#10;&lt;h3 id="why-this-happens"&gt;Why this happens &lt;a class="anchor" href="#why-this-happens" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;These patterns emerge because AI is trained on public code that often:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Maintains backward compatibility for years&lt;/li&gt;&#10;&lt;li&gt;Uses defensive programming for public APIs&lt;/li&gt;&#10;&lt;li&gt;Includes extensive error handling for user input&lt;/li&gt;&#10;&lt;li&gt;Follows &amp;ldquo;enterprise&amp;rdquo; patterns even for simple scripts&lt;/li&gt;&#10;&lt;li&gt;Contains debugging code from development&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This is why &lt;strong&gt;constraints are essential&lt;/strong&gt;—without them, Claude defaults to these &amp;ldquo;safe&amp;rdquo; but overcomplicated patterns.&lt;/p&gt;&#10;&lt;h2 id="8-critical-success-factors-what-actually-makes-this-work"&gt;8. Critical success factors: what actually makes this work &lt;a class="anchor" href="#8-critical-success-factors-what-actually-makes-this-work" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;After two months of intense usage, here are the non-negotiable practices that make agentic coding actually productive:&lt;/p&gt;&#10;&lt;h3 id="teach-it-your-test-commands-day-1-priority"&gt;Teach it your test commands (day 1 priority) &lt;a class="anchor" href="#teach-it-your-test-commands-day-1-priority" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;&lt;strong&gt;This is absolutely crucial.&lt;/strong&gt; Claude Code needs to know how to run your tests and how to activate the environment:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# To run tests, use: &lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;uv run pytest tests/ -xvs&lt;span class="s2"&gt;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;# For coverage:&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;uv run pytest --cov=src --cov-report=term-missing&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;# To run specific test&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;uv run pytest tests/test_module.py::test_function&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Without this, it&amp;rsquo;s just guessing whether code works.&#10;With it, it becomes genuinely useful.&lt;/p&gt;&#10;&lt;h3 id="git-commits-are-your-safety-net"&gt;Git commits are your safety net &lt;a class="anchor" href="#git-commits-are-your-safety-net" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I commit &lt;strong&gt;obsessively&lt;/strong&gt; when using Claude Code:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;After every successful (even partial) feature implementation&lt;/li&gt;&#10;&lt;li&gt;Before letting it attempt any major refactoring&lt;/li&gt;&#10;&lt;li&gt;Whenever tests pass&lt;/li&gt;&#10;&lt;li&gt;Before any &amp;ldquo;cleanup&amp;rdquo; operation&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;But here&amp;rsquo;s the key: &lt;strong&gt;I develop every feature in its own branch&lt;/strong&gt;, even as a solo developer. My workflow:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Create a feature branch for each new feature or fix&lt;/li&gt;&#10;&lt;li&gt;Make frequent commits as snapshots (sometimes just a period for the message or tell Claude to commit)&lt;/li&gt;&#10;&lt;li&gt;Open a pull request to review the full diff myself&lt;/li&gt;&#10;&lt;li&gt;Merge only after reviewing all changes&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This has saved me from disaster multiple times.&#10;Git is your undo button when Claude goes nuclear (e.g., breaks or removes your code).&lt;/p&gt;&#10;&lt;h3 id="maintain-healthy-skepticism"&gt;Maintain healthy skepticism &lt;a class="anchor" href="#maintain-healthy-skepticism" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Never trust, always verify:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;&amp;ldquo;I fixed it!&amp;rdquo;&lt;/strong&gt; → &amp;ldquo;Show me the test output&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&amp;ldquo;It&amp;rsquo;s working now!&amp;rdquo;&lt;/strong&gt; → &amp;ldquo;Run the tests again with -xvs&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&amp;ldquo;The logs show success!&amp;rdquo;&lt;/strong&gt; → &amp;ldquo;Cat the actual log file&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&amp;ldquo;It&amp;rsquo;s production ready!&amp;rdquo;&lt;/strong&gt; → &amp;ldquo;Did you run the tests?&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Think of Claude Code as an enthusiastic junior developer who sometimes exaggerates their accomplishments.&lt;/p&gt;&#10;&lt;h3 id="force-it-to-clean-up-after-itself"&gt;Force it to clean up after itself &lt;a class="anchor" href="#force-it-to-clean-up-after-itself" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;After any debugging session, always:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;Review all your changes and remove:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- Debug print statements&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- Commented out code&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- Failed attempt implementations&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- Temporary test files&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;- Unused imports&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;My custom &lt;code&gt;/anti-cruft&lt;/code&gt; command automates this, but you can do it manually too.&lt;/p&gt;&#10;&lt;h3 id="code-coverage-is-your-friend"&gt;Code coverage is your friend &lt;a class="anchor" href="#code-coverage-is-your-friend" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;High test coverage (90%+) ensures:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The code Claude wrote actually runs&lt;/li&gt;&#10;&lt;li&gt;No dead code from failed attempts&lt;/li&gt;&#10;&lt;li&gt;All paths are exercised&lt;/li&gt;&#10;&lt;li&gt;You can refactor confidently&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="9-my-secret-weapon-voice-to-code-workflow"&gt;9. My secret weapon: voice-to-code workflow &lt;a class="anchor" href="#9-my-secret-weapon-voice-to-code-workflow" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of my biggest productivity multipliers isn&amp;rsquo;t Claude Code itself—it&amp;rsquo;s how I communicate with it.&#10;Using my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; tool, I&amp;rsquo;ve developed a voice-first workflow that&amp;rsquo;s transformed how I write prompts.&lt;/p&gt;&#10;&lt;h3 id="the-problem-with-typing-prompts"&gt;The problem with typing prompts &lt;a class="anchor" href="#the-problem-with-typing-prompts" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Effective agentic coding requires &lt;strong&gt;precise, detailed instructions&lt;/strong&gt;.&#10;A good prompt isn&amp;rsquo;t 20 words—it&amp;rsquo;s often 200-500 words explaining exactly what you want, what to avoid, and how to approach the problem.&#10;Most people don&amp;rsquo;t want to type that much.&lt;/p&gt;&#10;&lt;h3 id="my-voice-workflow"&gt;My voice workflow &lt;a class="anchor" href="#my-voice-workflow" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Here&amp;rsquo;s my actual workflow:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Start recording&lt;/strong&gt; with &lt;code&gt;agent-cli transcribe&lt;/code&gt; (hotkey triggered)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Review Claude&amp;rsquo;s changes&lt;/strong&gt; while speaking my thoughts aloud&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Speak for minutes&lt;/strong&gt; about what I want, what&amp;rsquo;s wrong, what to fix&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Paste the transcription&lt;/strong&gt; directly into Claude Code&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This is powered by OpenAI&amp;rsquo;s Whisper model running locally on my RTX 3090 at home.&#10;It&amp;rsquo;s more reliable than macOS dictation and gives me complete privacy.&lt;/p&gt;&#10;&lt;h3 id="why-this-works-so-well"&gt;Why this works so well &lt;a class="anchor" href="#why-this-works-so-well" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Rich prompts&lt;/strong&gt;: I naturally give more context when speaking&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Code review narration&lt;/strong&gt;: I can review code while explaining issues&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Thinking out loud&lt;/strong&gt;: Speaking helps clarify my own thoughts&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Speed&lt;/strong&gt;: Speaking is 3-4x faster than typing&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Precision&lt;/strong&gt;: I can be incredibly specific without typing fatigue&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;For example, instead of typing &amp;ldquo;fix the bug,&amp;rdquo; I might say:&lt;/p&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;&amp;ldquo;I&amp;rsquo;m looking at line 45 where you&amp;rsquo;re handling the authentication.&#10;The problem is you&amp;rsquo;re not checking if the token has expired before making the API call.&#10;Also, you&amp;rsquo;ve added a try-except block here that&amp;rsquo;s suppressing errors—remove that.&#10;And while you&amp;rsquo;re at it, the logging statement on line 52 is using the wrong format.&#10;Make sure to follow our project&amp;rsquo;s logging conventions&amp;hellip;&amp;rdquo;&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;This level of detail is what makes AI coding actually productive.&lt;/p&gt;&#10;&lt;h2 id="10-additional-tips-for-agentic-coding"&gt;10. Additional tips for agentic coding &lt;a class="anchor" href="#10-additional-tips-for-agentic-coding" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Beyond the critical success factors and voice workflow, here are more tips to maximize your productivity:&lt;/p&gt;&#10;&lt;h3 id="set-clear-constraints"&gt;Set clear constraints &lt;a class="anchor" href="#set-clear-constraints" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Create a &lt;code&gt;CLAUDE.md&lt;/code&gt; or similar file in your project root with your preferences:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-markdown" data-lang="markdown"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gu"&gt;## Project standards&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; Never use try/except to suppress errors silently&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; Always run pytest before marking task complete&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; Use type hints for all functions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;-&lt;/span&gt; Prefer simple solutions over clever ones&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="use-the-task-system"&gt;Use the task system &lt;a class="anchor" href="#use-the-task-system" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Claude Code&amp;rsquo;s todo system is great for complex work:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;1. ✅ Implement core functionality&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;2. ✅ Write comprehensive tests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;3. 🔄 Fix failing tests&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;4. ⏳ Add documentation&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="leverage-the-search-capabilities"&gt;Leverage the search capabilities &lt;a class="anchor" href="#leverage-the-search-capabilities" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Let Claude search for existing patterns:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&amp;ldquo;Find all API endpoint implementations in this project&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;Show me how we handle authentication elsewhere&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;What testing patterns are we using?&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="review-in-chunks"&gt;Review in chunks &lt;a class="anchor" href="#review-in-chunks" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Instead of reviewing 500 lines at once:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Have Claude implement a single feature&lt;/li&gt;&#10;&lt;li&gt;Review and understand it&lt;/li&gt;&#10;&lt;li&gt;Run tests&lt;/li&gt;&#10;&lt;li&gt;Commit(s) and PR&lt;/li&gt;&#10;&lt;li&gt;Move to the next feature&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="11-the-tools-ive-tried"&gt;11. The tools I&amp;rsquo;ve tried &lt;a class="anchor" href="#11-the-tools-ive-tried" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My journey through AI coding assistants has been evolutionary:&lt;/p&gt;&#10;&lt;h3 id="pre-ai-era"&gt;Pre-AI era &lt;a class="anchor" href="#pre-ai-era" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Manual coding with IDE autocomplete&lt;/li&gt;&#10;&lt;li&gt;Stack Overflow copy-paste&lt;/li&gt;&#10;&lt;li&gt;Productivity baseline: 1-2 packages per year&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="phase-1-copy-paste-tools-march-2023---july-2025"&gt;Phase 1: copy-paste tools (March 2023 - July 2025) &lt;a class="anchor" href="#phase-1-copy-paste-tools-march-2023---july-2025" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;ChatGPT/Claude Web&lt;/strong&gt; + my &lt;a href="https://www.nijho.lt/post/advent-of-open-source/15-clip-files/"&gt;&lt;code&gt;clip-files&lt;/code&gt;&lt;/a&gt; tool&lt;/li&gt;&#10;&lt;li&gt;Manual context sharing&lt;/li&gt;&#10;&lt;li&gt;Helpful for ideation and code review&lt;/li&gt;&#10;&lt;li&gt;Productivity: 3x improvement (from 2 to 6 packages/year)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="cursor-early-2024"&gt;Cursor (early 2024) &lt;a class="anchor" href="#cursor-early-2024" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Great autocomplete&lt;/li&gt;&#10;&lt;li&gt;Limited context awareness&lt;/li&gt;&#10;&lt;li&gt;Became frustratingly slow&lt;/li&gt;&#10;&lt;li&gt;Still led to my vibe coding disaster&lt;/li&gt;&#10;&lt;li&gt;Productivity: 5x improvement (but with quality issues)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="phase-2-claude-code-july-2025---present"&gt;Phase 2: Claude Code (July 2025 - present) &lt;a class="anchor" href="#phase-2-claude-code-july-2025---present" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Full codebase awareness&lt;/li&gt;&#10;&lt;li&gt;Can execute commands and debug&lt;/li&gt;&#10;&lt;li&gt;Self-correcting through test iterations&lt;/li&gt;&#10;&lt;li&gt;Maintains context across sessions&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;$70 spent on first night, $10,000 worth in first month&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;Productivity: 24x improvement over pre-AI baseline with maintained quality&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="openais-codex-cli-the-reasoning-beast"&gt;OpenAI&amp;rsquo;s Codex CLI (the reasoning beast) &lt;a class="anchor" href="#openais-codex-cli-the-reasoning-beast" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Recently tried OpenAI&amp;rsquo;s Codex—their new CLI alternative to Claude Code—and I&amp;rsquo;ll admit, for pure reasoning with their GPT-5-Codex model, it&amp;rsquo;s impressive:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Solved a race condition&lt;/strong&gt; in an unfamiliar language that took me hours with Claude Opus&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;More elegant solutions&lt;/strong&gt; for complex algorithmic problems&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Better at deep reasoning&lt;/strong&gt; when given the same context&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;But here&amp;rsquo;s why I still use Claude Code daily:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude Code&amp;rsquo;s UX is superior&lt;/strong&gt;: Resume conversations, better interface&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Codex&amp;rsquo;s CLI is fragile&lt;/strong&gt;: Hit Ctrl-C accidentally? Lose everything, start over (muscle memory keeps betraying me!)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude Code handles interruptions&lt;/strong&gt;: First Ctrl-C clears text, second quits gracefully&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;No session persistence&lt;/strong&gt;: Codex forgets everything, Claude Code remembers&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Context management&lt;/strong&gt;: Have to re-provide all context after accidental exits&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;For a complex race condition bug, Codex with GPT-5 gave me the most elegant solution.&#10;But for day-to-day development where I need reliability, good UX, and the ability to resume work?&lt;/p&gt;&#10;&lt;h3 id="why-not-copilot-or-other-cheaper-tools"&gt;Why not Copilot or other &amp;ldquo;cheaper&amp;rdquo; tools? &lt;a class="anchor" href="#why-not-copilot-or-other-cheaper-tools" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Let me be blunt: &lt;strong&gt;You get what you pay for.&lt;/strong&gt; People often say &amp;ldquo;I tried Copilot and it wasn&amp;rsquo;t that useful&amp;rdquo; or &amp;ldquo;Gemini in chat didn&amp;rsquo;t help much.&amp;rdquo; Of course not—these tools are &lt;strong&gt;at least 10x cheaper&lt;/strong&gt; than Claude Code with Opus.&lt;/p&gt;&#10;&lt;p&gt;Your $20/month GitHub Copilot subscription simply cannot provide the same quality or quantity of high-quality tokens as Claude Code.&#10;It&amp;rsquo;s like comparing a bicycle to a Ferrari and wondering why the bicycle isn&amp;rsquo;t as fast.&#10;The economics don&amp;rsquo;t work out:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Copilot&lt;/strong&gt;: $20/month for limited autocomplete&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Claude Code Pro&lt;/strong&gt;: $200/month for unlimited* agentic assistance (*capped, but generous)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Actual API value used&lt;/strong&gt;: $10,000+/month at my usage level&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The 10x price difference reflects a 10x (or more) difference in capability.&#10;Copilot is autocomplete on steroids.&#10;Claude Code is a tireless pair programming partner with perfect memory who can debug, test, and iterate.&#10;The ROI is obvious when you&amp;rsquo;re shipping 10x more code.&lt;/p&gt;&#10;&lt;h2 id="12-is-this-sustainable"&gt;12. Is this sustainable? &lt;a class="anchor" href="#12-is-this-sustainable" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You might wonder if this productivity is sustainable or if I&amp;rsquo;m just building lower-quality software faster.&#10;Here&amp;rsquo;s my honest assessment:&lt;/p&gt;&#10;&lt;h3 id="the-good"&gt;The good &lt;a class="anchor" href="#the-good" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Faster prototyping&lt;/strong&gt;: Ideas to working code in hours, not days&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Better test coverage&lt;/strong&gt;: AI never gets lazy about writing tests&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;More experimentation&lt;/strong&gt;: Lower cost to try new ideas&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Improved documentation&lt;/strong&gt;: AI loves writing docs (I don&amp;rsquo;t)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reduced burnout&lt;/strong&gt;: Less time on boilerplate, more on interesting problems&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-challenges"&gt;The challenges &lt;a class="anchor" href="#the-challenges" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Code review fatigue&lt;/strong&gt;: You must stay vigilant&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Dependency on tools&lt;/strong&gt;: What if Claude Code disappears?&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Cost&lt;/strong&gt;: $200/month Pro plan (but worth every penny given the $10K+ value)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;The temptation to &amp;ldquo;vibe&amp;rdquo;&lt;/strong&gt;: Constant discipline required&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Addiction potential&lt;/strong&gt;: I literally couldn&amp;rsquo;t stop coding, having the desire to deplete all tokens and get my money&amp;rsquo;s worth!&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="my-verdict"&gt;My verdict &lt;a class="anchor" href="#my-verdict" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;It&amp;rsquo;s absolutely sustainable &lt;strong&gt;if&lt;/strong&gt; you maintain discipline.&#10;The moment you start accepting code you don&amp;rsquo;t understand, you&amp;rsquo;re building a house of cards.&#10;But with proper review and testing, agentic AI is a massive force multiplier.&lt;/p&gt;&#10;&lt;h2 id="13-the-experience-multiplier-why-seniority-matters-more-than-ever"&gt;13. The experience multiplier: why seniority matters more than ever &lt;a class="anchor" href="#13-the-experience-multiplier-why-seniority-matters-more-than-ever" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s a counterintuitive truth about agentic AI tools: &lt;strong&gt;they amplify your existing skills exponentially, not linearly&lt;/strong&gt;.&#10;This creates a fascinating paradox where these tools become increasingly valuable as you become more experienced.&lt;/p&gt;&#10;&lt;h3 id="the-exponential-trap-for-beginners"&gt;The exponential trap for beginners &lt;a class="anchor" href="#the-exponential-trap-for-beginners" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;For beginners, agentic tools can feel like a superpower initially.&#10;They can build a working application in hours!&#10;But here&amp;rsquo;s the danger: without the experience to recognize bad patterns, they&amp;rsquo;re essentially building at 10x speed in the wrong direction.&#10;It&amp;rsquo;s like giving a Formula 1 car to someone who just got their driver&amp;rsquo;s license—the speed multiplies both the distance traveled and the potential for catastrophic crashes.&lt;/p&gt;&#10;&lt;p&gt;A beginner using Claude Code might:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Accept complex solutions they don&amp;rsquo;t understand&lt;/li&gt;&#10;&lt;li&gt;Build massive technical debt at record speed&lt;/li&gt;&#10;&lt;li&gt;Miss architectural problems that will haunt them later&lt;/li&gt;&#10;&lt;li&gt;Create code that &amp;ldquo;works&amp;rdquo; but is impossible to maintain&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;They&amp;rsquo;re forced into a difficult position: either slow down to understand everything (negating the speed benefit) or accumulate technical debt at an exponential rate.&lt;/p&gt;&#10;&lt;h3 id="the-senior-developer-advantage"&gt;The senior developer advantage &lt;a class="anchor" href="#the-senior-developer-advantage" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;For experienced developers, it&amp;rsquo;s a completely different game.&#10;When I look at Claude Code&amp;rsquo;s suggestions, I can instantly recognize:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&amp;ldquo;Oh, that&amp;rsquo;s the Factory pattern—makes sense here&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;This error handling is too defensive, let&amp;rsquo;s simplify&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;That&amp;rsquo;s going to cause N+1 queries, need to refactor&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;&amp;ldquo;This violates our project&amp;rsquo;s conventions, fix it&amp;rdquo;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The review process that might take a beginner hours takes me minutes.&#10;I&amp;rsquo;m not learning what the code does—I&amp;rsquo;m validating that it does what I already know it should do.&lt;/p&gt;&#10;&lt;h3 id="the-right-way-for-every-level"&gt;The right way for every level &lt;a class="anchor" href="#the-right-way-for-every-level" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;That said, everyone can benefit from agentic tools—you just need to adjust your approach:&lt;/p&gt;&#10;&lt;h4 id="for-beginners"&gt;For beginners&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Use AI as a learning accelerator&lt;/strong&gt;: Ask it to explain every decision&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Build small projects first&lt;/strong&gt;: Master fundamentals before scaling up&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Prioritize understanding over speed&lt;/strong&gt;: Better to build slowly and learn&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Pair with mentors&lt;/strong&gt;: Have experienced developers review AI-generated code&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="for-intermediate-developers"&gt;For intermediate developers&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Focus on patterns&lt;/strong&gt;: Use AI to learn architectural patterns and best practices&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Experiment safely&lt;/strong&gt;: Try new approaches in side projects first&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Question everything&lt;/strong&gt;: Don&amp;rsquo;t accept solutions without understanding the tradeoffs&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="for-senior-developers"&gt;For senior developers&lt;/h4&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Leverage for velocity&lt;/strong&gt;: Use your experience to review and direct quickly&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Focus on architecture&lt;/strong&gt;: Let AI handle implementation while you design systems&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Teach the AI&lt;/strong&gt;: Create project-specific guidelines to improve output quality&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Push boundaries&lt;/strong&gt;: Explore more ambitious projects now that implementation is faster&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-real-multiplier-effect"&gt;The real multiplier effect &lt;a class="anchor" href="#the-real-multiplier-effect" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;The productivity boost isn&amp;rsquo;t just about writing code faster.&#10;For senior developers, agentic tools multiply:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Architecture exploration&lt;/strong&gt;: Test multiple approaches quickly&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Refactoring confidence&lt;/strong&gt;: Refactor fearlessly with AI helping maintain functionality&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Learning velocity&lt;/strong&gt;: Explore new languages and frameworks with a knowledgeable assistant&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Documentation quality&lt;/strong&gt;: Finally have time (and help) for comprehensive docs&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Testing coverage&lt;/strong&gt;: AI never skips tests, even for &amp;ldquo;simple&amp;rdquo; functions&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This is why I&amp;rsquo;ve been able to ship 14 packages in 18 months.&#10;It&amp;rsquo;s not just that I&amp;rsquo;m writing code faster—I&amp;rsquo;m able to explore ideas, validate approaches, and iterate on designs at a pace that was previously impossible.&lt;/p&gt;&#10;&lt;h2 id="14-reality-check-what-ai-can-and-cant-do"&gt;14. Reality check: what AI can and can&amp;rsquo;t do &lt;a class="anchor" href="#14-reality-check-what-ai-can-and-cant-do" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Many people try AI coding and give up disappointed.&#10;That&amp;rsquo;s because they&amp;rsquo;re treating it like a magic genie that will solve the unsolved problems of the universe.&#10;&lt;strong&gt;It won&amp;rsquo;t.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;h3 id="what-ai-can-do-the-churn-work"&gt;What AI CAN do (the churn work) &lt;a class="anchor" href="#what-ai-can-do-the-churn-work" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;AI excels at tasks you could do yourself but would take hours:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Setting up CI/CD pipelines&lt;/strong&gt;: Boilerplate YAML configuration&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Writing tests&lt;/strong&gt;: Especially unit tests for existing code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Fixing dependency issues&lt;/strong&gt;: Adapting to breaking changes in libraries&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;CRUD operations&lt;/strong&gt;: Basic create, read, update, delete functionality&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Data transformations&lt;/strong&gt;: Converting between formats, parsing, serialization&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Documentation&lt;/strong&gt;: README files, docstrings, API documentation&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Refactoring&lt;/strong&gt;: Renaming variables, extracting functions, reorganizing code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Bug fixes&lt;/strong&gt;: Especially those with clear error messages&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This is the &amp;ldquo;churn&amp;rdquo;—the necessary but time-consuming work that makes up 80% of development.&lt;/p&gt;&#10;&lt;h3 id="what-ai-cant-do-the-creative-work"&gt;What AI CAN&amp;rsquo;T do (the creative work) &lt;a class="anchor" href="#what-ai-cant-do-the-creative-work" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Don&amp;rsquo;t expect AI to:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Solve novel algorithmic problems&lt;/strong&gt;: It won&amp;rsquo;t invent the next PageRank&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Make architectural decisions&lt;/strong&gt;: It can&amp;rsquo;t decide if you need microservices&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Understand business logic&lt;/strong&gt;: It doesn&amp;rsquo;t know why your company does things&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Create truly innovative solutions&lt;/strong&gt;: It remixes what it&amp;rsquo;s seen, not invents&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Make judgment calls&lt;/strong&gt;: Security vs convenience, performance vs maintainability&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="the-sweet-spot"&gt;The sweet spot &lt;a class="anchor" href="#the-sweet-spot" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;I use AI for tasks where:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;I know how to do it&lt;/strong&gt; but it would take time&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;The solution exists&lt;/strong&gt; somewhere in its training data&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Success is measurable&lt;/strong&gt; through tests or clear output&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;The problem is well-defined&lt;/strong&gt; with clear constraints&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t about AI doing things you can&amp;rsquo;t do—it&amp;rsquo;s about AI doing things you don&amp;rsquo;t want to spend time doing.&#10;Once you understand this, AI becomes incredibly powerful.&lt;/p&gt;&#10;&lt;h2 id="15-looking-forward-the-future-of-development"&gt;15. Looking forward: the future of development &lt;a class="anchor" href="#15-looking-forward-the-future-of-development" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As I showed in my &lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;local AI journey&lt;/a&gt;, I&amp;rsquo;m deeply interested in where AI and development intersect.&#10;Agentic coding represents a fundamental shift in how we build software:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;From writing code to reviewing and directing&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;From memorizing APIs to understanding patterns&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;From debugging alone to collaborative problem-solving&lt;/strong&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;From slower iteration to rapid experimentation&lt;/strong&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t about replacing developers—it&amp;rsquo;s about amplifying our capabilities.&#10;I&amp;rsquo;m still the architect, the decision-maker, and the quality gatekeeper.&#10;But now I can focus on the interesting problems while my AI assistant handles the implementation details.&lt;/p&gt;&#10;&lt;h2 id="16-conclusion-principles-over-process"&gt;16. Conclusion: principles over process &lt;a class="anchor" href="#16-conclusion-principles-over-process" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My journey from vibe coding skeptic to agentic coding advocate might seem like a complete reversal, but it&amp;rsquo;s not.&#10;My core principle remains unchanged: &lt;strong&gt;never commit code you don&amp;rsquo;t understand&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;What&amp;rsquo;s changed is the tooling has finally caught up to the promise.&#10;With agentic AI assistants, I can maintain my standards while dramatically increasing my output.&#10;Most of those 32 packages on PyPI have users and are well-tested and documented projects that solve real problems.&lt;/p&gt;&#10;&lt;p&gt;The key is treating AI as what it is: an incredibly powerful assistant, not a replacement for thinking.&#10;Use it to explore ideas faster, implement solutions quicker, and test more thoroughly.&#10;But always, always understand what you&amp;rsquo;re building.&lt;/p&gt;&#10;&lt;p&gt;As I continue building in public and sharing my tools, I&amp;rsquo;m excited to see where this technology takes us.&#10;If you&amp;rsquo;re interested in trying agentic coding yourself, start small, maintain your standards, and prepare to be amazed by what you can build.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;What&amp;rsquo;s your experience with AI coding assistants? Have you tried moving from generative to agentic tools? I&amp;rsquo;d love to hear your thoughts!&lt;/em&gt;&lt;/p&gt;&#10;&lt;h2 id="links-and-resources"&gt;Links and resources &lt;a class="anchor" href="#links-and-resources" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://claude.ai/code" target="_blank" rel="noopener"&gt;Claude Code&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://pypi.org/user/basnijholt/" target="_blank" rel="noopener"&gt;My PyPI packages&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt" target="_blank" rel="noopener"&gt;My GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/vibe-coding/"&gt;Original vibe coding post&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/local-ai-journey/"&gt;My local AI journey&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://www.nijho.lt/post/using-llms/"&gt;Using LLMs effectively&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>How a 3090 turned into two local‑first AI projects 🎮</title><link>https://www.nijho.lt/post/local-ai-journey/</link><pubDate>Mon, 14 Jul 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/local-ai-journey/</guid><description>&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-introduction-the-unplayed-games"&gt;1. Introduction: The Unplayed Games&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-the-rocky-road-to-a-working-setup"&gt;2. The Rocky Road to a Working Setup&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-the-first-victory-agent-cli-"&gt;3. The First Victory: &lt;code&gt;agent-cli&lt;/code&gt; 🐍&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-the-grand-ambition-aibrain-"&gt;4. The Grand Ambition: &lt;code&gt;AIBrain&lt;/code&gt; 🧠&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-conclusion-the-journey-continues"&gt;5. Conclusion: The Journey Continues&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-introduction-the-unplayed-games"&gt;1. Introduction: The Unplayed Games &lt;a class="anchor" href="#1-introduction-the-unplayed-games" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I&amp;rsquo;ve wanted to dabble with local AI for a long time, mainly because of the possibilities it unlocks.&#10;Local AI allows me to use all of my data—financial records, personal messages, location history, even transcribing everything I say—without the privacy concerns of sending it to a cloud provider.&#10;This level of deep, personal data analysis is only something I&amp;rsquo;d be comfortable with on my own hardware.&lt;/p&gt;&#10;&lt;p&gt;However, I couldn&amp;rsquo;t justify buying a powerful GPU just for an imagined AI project that I might never really start.&#10;Then it hit me: I could also use it for gaming (duh).&#10;Because I really enjoyed &lt;em&gt;The Last of Us&lt;/em&gt; series, I thought, “&lt;em&gt;Okay, why not play &lt;strong&gt;The Last of Us&lt;/strong&gt; on PC?&lt;/em&gt;”&#10;This was the push I needed.&#10;So, a couple of weeks ago, I convinced myself to buy someone&amp;rsquo;s old gaming machine.&#10;After many deep research sessions with ChatGPT about the best bang-for-the-buck consumer-grade GPU, I landed on an NVIDIA 3090.&#10;I found an (old) beast of a machine, and my initial idea was set.&lt;/p&gt;&#10;&lt;details&gt;&#10; &lt;summary&gt;Click here to see the full system specs ($1350 for all this!)&lt;/summary&gt;&#10; &lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;GPU:&lt;/strong&gt; ASUS ROG STRIX RTX 3090 OC (24GB)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;CPU:&lt;/strong&gt; AMD Ryzen 9 3900X (12-Core)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Motherboard:&lt;/strong&gt; ASUS ROG Crosshair VIII Hero&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Power Supply:&lt;/strong&gt; Be Quiet! 1200W Dark Power Pro&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;RAM:&lt;/strong&gt; 32GB G.Skill Trident Z Royal DDR4&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Storage:&lt;/strong&gt; 2TB Intel M.2 NVMe SSD&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Case:&lt;/strong&gt; Corsair 4000D Airflow&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;CPU Cooler:&lt;/strong&gt; Thermalright Peerless Assassin 120&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&#10;&lt;/details&gt;&#10;&#10;&lt;p&gt;Fast forward four weeks.&#10;I haven&amp;rsquo;t played a single minute, but my machine is now indexing 200 GB of email archives and facing a serious performance bottleneck I&amp;rsquo;ll get to later.&#10;That &amp;ldquo;gaming&amp;rdquo; machine has been humming away, but not rendering virtual worlds.&#10;It&amp;rsquo;s been training, transcribing, and thinking.&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;m writing this post simply because I am so enthusiastic about local AI.&#10;I&amp;rsquo;ve found that local models are surprisingly powerful for specific use cases.&#10;Of course, they aren&amp;rsquo;t going to replace Gemini or Claude for coding, but for many other applications, they work incredibly well.&#10;Lately, I&amp;rsquo;ve been so obsessed with this that I&amp;rsquo;m sleeping significantly less and spending all my free hours working on it.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; This post is the story of how a quest for gaming turned into a deep dive into local, private AI.&#10;I&amp;rsquo;ll share the two open-source Python packages that came out of it, &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/basnijholt/aibrain" target="_blank" rel="noopener"&gt;&lt;code&gt;AIBrain&lt;/code&gt;&lt;/a&gt;, and the lessons I learned along the way.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="2-the-rocky-road-to-a-working-setup"&gt;2. The Rocky Road to a Working Setup &lt;a class="anchor" href="#2-the-rocky-road-to-a-working-setup" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Before I could even get to the fun AI stuff, I had to wrestle with the machine itself.&#10;I started with Pop!_OS, which is supposed to be a great out of the box solution that &amp;ldquo;just works&amp;rdquo;.&#10;However, it&amp;rsquo;s been a long time since I used Linux on the desktop; my experience is almost exclusively with servers.&#10;I quickly installed some of the wrong NVIDIA drivers and ended up debugging stuff in Grub.&#10;I got frustrated with the different commands I had to run to set up everything and realized that reproducing this system was going to be a massive pain.&#10;Since I&amp;rsquo;ve grown to love Nix on my Mac with Nix-Darwin, I decided to switch the whole system to &lt;strong&gt;NixOS&lt;/strong&gt;.&#10;This has been an amazing decision.&#10;Even though there are many pain points with Nix, I think it is well worth it.&#10;For those interested, you can see the complete setup, including all the local AI services, in my &lt;a href="https://github.com/basnijholt/dotfiles/blob/841cd5fb94b65556e7a2cc7d8ea618f86b50bf1d/configs/nixos/configuration.nix" target="_blank" rel="noopener"&gt;NixOS configuration on GitHub&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h2 id="3-the-first-victory-agent-cli-"&gt;3. The First Victory: &lt;code&gt;agent-cli&lt;/code&gt; 🐍 &lt;a class="anchor" href="#3-the-first-victory-agent-cli-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;With a stable system, I quickly got started with a few scripts.&#10;These soon evolved into my first real project of this adventure: &lt;a href="https://github.com/basnijholt/agent-cli" target="_blank" rel="noopener"&gt;&lt;code&gt;agent-cli&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;agent-cli&lt;/code&gt; is a collection of &lt;strong&gt;local-first&lt;/strong&gt;, AI-powered command-line agents that run entirely on your machine.&#10;The core philosophy is privacy; your data never leaves your computer.&#10;It&amp;rsquo;s designed for seamless integration with system-wide hotkeys.&#10;I&amp;rsquo;m now using it constantly.&lt;/p&gt;&#10;&lt;p&gt;Instead of typing, I now dictate almost everything.&#10;A quick hotkey, and &lt;code&gt;agent-cli transcribe&lt;/code&gt; turns my speech into text.&#10;Another hotkey, and &lt;code&gt;agent-cli autocorrect&lt;/code&gt; cleans it up using a local LLM running on &lt;strong&gt;Ollama&lt;/strong&gt;.&#10;It has genuinely streamlined my workflow.&#10;For example, I can pipe the tools together, like correcting text from my clipboard and then having it spoken aloud: &lt;code&gt;agent-cli autocorrect | agent-cli speak&lt;/code&gt;.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;⚡ Surprising Speed: Local vs. Cloud&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;One of my biggest surprises was the raw speed of local models.&#10;While I added an OpenAI provider to &lt;code&gt;agent-cli&lt;/code&gt; for those without local hardware (someone I know wanted to try it), I consistently find that local execution is faster than waiting on a cloud API.&#10;For example, a local transcription with Whisper + Ollama lands in my clipboard in well under a second—often beating the network round-trip to a remote service.&lt;/p&gt;&#10;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;The toolkit includes:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;autocorrect&lt;/code&gt;: Fixes grammar and spelling.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;transcribe&lt;/code&gt;: Uses a local Whisper model for speech-to-text.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;speak&lt;/code&gt;: Converts text to speech with a local TTS engine.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;voice-edit&lt;/code&gt;: A voice-powered clipboard assistant.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;assistant&lt;/code&gt;: A hands-free voice assistant using a wake word.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;chat&lt;/code&gt;: A conversational AI with tool-calling capabilities.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;It&amp;rsquo;s been a fantastic success in my personal workflow, and it&amp;rsquo;s all open-source for you to try.&#10;Contributions and ideas welcome!&lt;/p&gt;&#10;&lt;p&gt;Once I trusted my toolchain, the obvious next step was to feed &lt;em&gt;all&lt;/em&gt; my data into it.&lt;/p&gt;&#10;&lt;h2 id="4-the-grand-ambition-aibrain-"&gt;4. The Grand Ambition: &lt;code&gt;AIBrain&lt;/code&gt; 🧠 &lt;a class="anchor" href="#4-the-grand-ambition-aibrain-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My second package, &lt;a href="https://github.com/basnijholt/aibrain" target="_blank" rel="noopener"&gt;&lt;code&gt;AIBrain&lt;/code&gt;&lt;/a&gt;, is a much larger endeavor.&#10;The vision is to create a &amp;ldquo;life-OS&amp;rdquo;—a private, local AI that processes all my personal data (emails, calendar, files, photos, messages, browser history, location data) to generate summaries and answer questions, eventually allowing for queries like:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aibrain ask &lt;span class="s2"&gt;&amp;#34;When did I get into landscape photography?&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aibrain ask &lt;span class="s2"&gt;&amp;#34;How many countries did I visit between 2015-2025?&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This project led me to explore the landscape of agentic frameworks.&#10;I started with &lt;strong&gt;CrewAI&lt;/strong&gt;, but I quickly found that despite the hype and funding, it had some painful problems (specifically &lt;a href="https://github.com/crewAIInc/crewAI/issues/3031" target="_blank" rel="noopener"&gt;this issue&lt;/a&gt; where things just fail without any helpful error messages).&#10;I decided to switch to &lt;strong&gt;LangGraph&lt;/strong&gt;, which felt more robust.&#10;I also chose to not use &lt;strong&gt;PydanticAI&lt;/strong&gt; (which I used in &lt;code&gt;agent-cli&lt;/code&gt;) because its &lt;strong&gt;Ollama&lt;/strong&gt; support is just a wrapper around the OpenAI-compatible API, which doesn&amp;rsquo;t expose all the useful options (I even opened &lt;a href="https://github.com/ollama/ollama/pull/11249/" target="_blank" rel="noopener"&gt;a PR&lt;/a&gt; in Ollama to make its OpenAI compatible API more feature-complete, but it has not been merged yet).&lt;/p&gt;&#10;&lt;p&gt;The core infrastructure of &lt;code&gt;AIBrain&lt;/code&gt; is ready.&#10;It can index emails, calendar events, and files in various formats (PDF, Excel, PowerPoint, images).&#10;However, I&amp;rsquo;ve hit a significant challenge.&lt;/p&gt;&#10;&lt;aside class="callout callout-warning"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;🔥 The Performance Bottleneck&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;Even with a 12-core CPU and 24GB GPU, processing just a few days’ worth of email made the fans scream for half an hour.&#10;Processing hundreds of gigabytes of personal data is a massive undertaking, and it&amp;rsquo;s clear that my current approach isn&amp;rsquo;t scalable enough.&lt;/p&gt;&#10;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="5-conclusion-the-journey-continues"&gt;5. Conclusion: The Journey Continues &lt;a class="anchor" href="#5-conclusion-the-journey-continues" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This past month has been a whirlwind.&#10;I set out to play games and ended up with two open-source AI packages and a much deeper appreciation for the power sitting in a consumer-grade GPU.&#10;It&amp;rsquo;s incredible what you can achieve with local hardware today.&lt;/p&gt;&#10;&lt;p&gt;&lt;code&gt;agent-cli&lt;/code&gt; is a finished, polished tool that I use daily.&#10;&lt;code&gt;AIBrain&lt;/code&gt; is a much bigger dream, and I&amp;rsquo;m still figuring out how to solve the performance puzzle to make it truly practical.&#10;Next up: smarter chunking with LangGraph, vector-DB swap-outs, and GPU scheduling tricks.&lt;/p&gt;&#10;&lt;p&gt;This experience has reinforced my passion for local-first software and open-source development.&#10;The future of personal, private AI is being built right now, not just in large corporate labs, but in the homes of hobbyists tinkering with their gaming rigs.&lt;/p&gt;&#10;&lt;p&gt;⭐ If this resonates, star the repos &amp;amp; drop issues/questions.&lt;/p&gt;&#10;&lt;p&gt;And who knows, maybe I&amp;rsquo;ll even find the time to play &amp;lsquo;The Last of Us&amp;rsquo;.&lt;/p&gt;&#10;</description></item><item><title>Confessions of an asymmetric hypocrite: on Python dependencies</title><link>https://www.nijho.lt/post/dependencies/</link><pubDate>Sun, 27 Apr 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/dependencies/</guid><description>&lt;h2 id="introduction-the-dependency-dilemma-"&gt;Introduction: The Dependency Dilemma 🤔 &lt;a class="anchor" href="#introduction-the-dependency-dilemma-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I just listened to a podcast &amp;ldquo;&lt;a href="https://www.youtube.com/watch?v=5ZyzeeYZgeM" target="_blank" rel="noopener"&gt;Build software that lasts!&lt;/a&gt;&amp;rdquo; with Bert Hubert (a fellow Dutch), who prefers to reduce the number of dependencies to an absolute minimum (also see his related blog posts [&lt;a href="https://berthub.eu/articles/posts/on-long-term-software-development/" target="_blank" rel="noopener"&gt;1&lt;/a&gt;] and [&lt;a href="https://berthub.eu/articles/posts/a-2024-plea-for-lean-software/" target="_blank" rel="noopener"&gt;2&lt;/a&gt;]).&#10;While I agree one shouldn&amp;rsquo;t use &lt;a href="https://www.npmjs.com/package/is-even" target="_blank" rel="noopener"&gt;&lt;code&gt;is-even&lt;/code&gt;&lt;/a&gt; as a dependency (&lt;a href="https://www.npmjs.com/package/is-odd" target="_blank" rel="noopener"&gt;&lt;code&gt;is-odd&lt;/code&gt;&lt;/a&gt; is a better choice 😏), I think there is a lot of value in reducing the number of dependencies but &lt;em&gt;also&lt;/em&gt; in using the right tool for the job and not continuously re-inventing the wheel.&#10;The podcast got me thinking about my own stance on dependencies and how I actively avoid introducing dependencies into my libraries while expecting (hoping 🤞) others to depend on my work.&lt;/p&gt;&#10;&lt;p&gt;Like many software developers, I&amp;rsquo;ve spent countless hours wrestling with dependencies.&#10;Dependency hell is easy to fall into, &lt;em&gt;especially&lt;/em&gt; in dynamic languages like Python.&#10;Those moments where installing or updating one package breaks another, or where a tiny library pulls in hundreds of transitive dependencies, are frustratingly common.&#10;This frustration partly motivated me to create &lt;a href="https://github.com/basnijholt/unidep" target="_blank" rel="noopener"&gt;&lt;code&gt;unidep&lt;/code&gt;&lt;/a&gt;, a tool aimed at simplifying dependency management across different Python tools like &lt;code&gt;pip&lt;/code&gt; and &lt;code&gt;conda&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;But working on &lt;code&gt;unidep&lt;/code&gt; and my other projects forces me to think about my own relationship with dependencies.&#10;I&amp;rsquo;ve realized I operate with what feels like an &amp;ldquo;asymmetric hypocrisy.&amp;rdquo;&#10;My standards for the libraries I &lt;em&gt;publish&lt;/em&gt; are extremely strict regarding which external dependencies I &lt;em&gt;consume&lt;/em&gt;.&#10;Yet, as an author of over 30 Python packages, I inherently &lt;em&gt;produce&lt;/em&gt; dependencies, hoping others will adopt my work.&#10;And then, when building applications or CLIs, my caution often disappears entirely.&lt;/p&gt;&#10;&lt;p&gt;This post dives into that asymmetry.&#10;It&amp;rsquo;s about the different hats I wear: the minimalist library author (as a dependency &lt;em&gt;consumer&lt;/em&gt;), the hopeful library author (as a dependency &lt;em&gt;producer&lt;/em&gt;), and the pragmatic application developer.&#10;In this post, I&amp;rsquo;ll explain why I take these different approaches and why it&amp;rsquo;s really about the situation, not a contradiction.&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#introduction-the-dependency-dilemma-"&gt;Introduction: The Dependency Dilemma 🤔&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#1-the-library-author-hat--as-dependency-consumer-maximum-caution"&gt;1. The Library Author Hat 🎩 (as Dependency Consumer): Maximum Caution&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-the-library-author-hat--as-dependency-producer-the-paradox"&gt;2. The Library Author Hat 🎩 (as Dependency Producer): The Paradox&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-the-application-developer--contributor-hat--practicality-is-key"&gt;3. The Application Developer / Contributor Hat 🧢: Practicality is Key&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-conclusion-not-hypocrisy-but-context-driven-strategy-"&gt;4. Conclusion: Not Hypocrisy, but Context-Driven Strategy 🙏&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; I&amp;rsquo;m extremely strict about adding external dependencies to my &lt;em&gt;libraries&lt;/em&gt;, preferring widely-used, low-dependency packages.&#10;Simultaneously, I &lt;em&gt;create&lt;/em&gt; libraries expecting adoption.&#10;For &lt;em&gt;applications&lt;/em&gt; (especially CLIs in isolated environments), I&amp;rsquo;m far more liberal with dependencies to build features quickly.&#10;It&amp;rsquo;s all about managing risks depending on the situation.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="1-the-library-author-hat--as-dependency-consumer-maximum-caution"&gt;1. The Library Author Hat 🎩 (as Dependency Consumer): Maximum Caution &lt;a class="anchor" href="#1-the-library-author-hat--as-dependency-consumer-maximum-caution" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When I build and publish an open-source Python library – like &lt;a href="https://github.com/python-adaptive/adaptive" target="_blank" rel="noopener"&gt;&lt;code&gt;Adaptive&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/pipefunc/pipefunc" target="_blank" rel="noopener"&gt;&lt;code&gt;pipefunc&lt;/code&gt;&lt;/a&gt;, or &lt;a href="https://github.com/basnijholt/unidep" target="_blank" rel="noopener"&gt;&lt;code&gt;unidep&lt;/code&gt;&lt;/a&gt; – my primary focus shifts to the &lt;em&gt;users&lt;/em&gt; who will depend on my code.&#10;My choices directly impact their projects.&#10;This responsibility means I have to be very careful about adding external dependencies:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Minimize and Scrutinize:&lt;/strong&gt; Fewer dependencies mean fewer potential conflicts for users.&#10;I aggressively minimize the core runtime dependency list.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Favor Battle-Tested Dependencies:&lt;/strong&gt; I strongly prefer dependencies that are already widely adopted and trusted by the community.&#10;(I have been called that person that always wants the latest and greatest, the truth is that I am a sucker for shiny new things but typically only adopt them once they are already quite popular.)&#10;Think &lt;code&gt;numpy&lt;/code&gt; or &lt;code&gt;cloudpickle&lt;/code&gt;.&#10;These are less likely to cause unexpected issues or disappear overnight.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Low Transitive Dependency Count:&lt;/strong&gt; A key criterion is how many &lt;em&gt;other&lt;/em&gt; packages a potential dependency pulls in.&#10;Ideally, I choose dependencies with zero or very few further dependencies.&#10;For example, in &lt;a href="https://github.com/pipefunc/pipefunc" target="_blank" rel="noopener"&gt;&lt;code&gt;pipefunc&lt;/code&gt;&lt;/a&gt;, dependencies like &lt;a href="https://numpy.org/" target="_blank" rel="noopener"&gt;&lt;code&gt;numpy&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://networkx.org/" target="_blank" rel="noopener"&gt;&lt;code&gt;networkx&lt;/code&gt;&lt;/a&gt;, and &lt;a href="https://github.com/cloudpipe/cloudpickle" target="_blank" rel="noopener"&gt;&lt;code&gt;cloudpickle&lt;/code&gt;&lt;/a&gt; are good examples – they are popular and don&amp;rsquo;t rely on many other things.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Optional Dependencies for Heavy Features:&lt;/strong&gt; If a feature really needs a large or less common dependency, I try making it a &lt;em&gt;optional&lt;/em&gt; extra (&lt;code&gt;project.optional-dependencies&lt;/code&gt;).&#10;Users opt-in only if they need that specific capability.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Avoid Pinning (Mostly):&lt;/strong&gt; As mentioned before, hard version pins (&lt;code&gt;==1.2.3&lt;/code&gt;) in libraries are usually harmful.&#10;Minimum versions (&lt;code&gt;&amp;gt;=1.2&lt;/code&gt;) or safe upper bounds (&lt;code&gt;&amp;lt;2.0&lt;/code&gt;) are preferred.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;License Awareness:&lt;/strong&gt; The license of a dependency matters immensely, especially regarding compatibility and obligations (&lt;a href="https://www.nijho.lt/post/gpl/"&gt;GPL considerations&lt;/a&gt;).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;The guiding principle is: &lt;strong&gt;Do not cause pain for your users.&lt;/strong&gt;&#10;A library should integrate smoothly into diverse environments.&lt;/p&gt;&#10;&lt;h2 id="2-the-library-author-hat--as-dependency-producer-the-paradox"&gt;2. The Library Author Hat 🎩 (as Dependency Producer): The Paradox &lt;a class="anchor" href="#2-the-library-author-hat--as-dependency-producer-the-paradox" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Here&amp;rsquo;s where the &amp;ldquo;hypocrisy&amp;rdquo; might seem to surface.&#10;While I&amp;rsquo;m cautious about &lt;em&gt;consuming&lt;/em&gt; dependencies for my libraries, I am also the author of over 30 packages.&#10;I invest time and effort into these tools, naturally hoping they prove useful and that others &lt;em&gt;will adopt them&lt;/em&gt; – making &lt;em&gt;my&lt;/em&gt; libraries dependencies in &lt;em&gt;their&lt;/em&gt; projects.&lt;/p&gt;&#10;&lt;p&gt;Is it hypocritical to be wary of adding dependencies while simultaneously creating them for others?&#10;Perhaps slightly, but it&amp;rsquo;s also the nature of contributing to an ecosystem.&#10;I try to handle this by strictly following the rules from Section 1 for my own libraries.&#10;If I expect others to rely on my code, I feel responsible to make that dependency as&#10;low-risk and stable as possible.&#10;I want my libraries to be the kind of well-behaved, minimal-friction dependencies&#10;that I myself would be comfortable adding.&lt;/p&gt;&#10;&lt;h2 id="3-the-application-developer--contributor-hat--practicality-is-key"&gt;3. The Application Developer / Contributor Hat 🧢: Practicality is Key &lt;a class="anchor" href="#3-the-application-developer--contributor-hat--practicality-is-key" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When the context shifts to building an application – like a command-line tool, a web service, or a personal project – my rules become &lt;em&gt;much&lt;/em&gt; less strict.&#10;The key differences are isolation (keeping things separate) and how far the effects reach.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Isolation Reduces Risk:&lt;/strong&gt; Applications often run in controlled, isolated environments.&#10;&lt;a href="https://www.docker.com/" target="_blank" rel="noopener"&gt;&lt;code&gt;Docker&lt;/code&gt;&lt;/a&gt;, &lt;code&gt;conda&lt;/code&gt;/&lt;a href="https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html" target="_blank" rel="noopener"&gt;&lt;code&gt;micromamba&lt;/code&gt;&lt;/a&gt; (&lt;a href="https://www.nijho.lt/post/python-environments/"&gt;Python Environment Jungle post&lt;/a&gt;), or simple &lt;code&gt;venv&lt;/code&gt;s contain the dependencies.&#10;A conflict within the application&amp;rsquo;s environment doesn&amp;rsquo;t break the user&amp;rsquo;s entire system or other unrelated projects.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;CLIs as a Prime Example:&lt;/strong&gt; Many tools I&amp;rsquo;ve built are CLIs (like &lt;a href="https://github.com/basnijholt/tuitorial" target="_blank" rel="noopener"&gt;&lt;code&gt;tuitorial&lt;/code&gt;&lt;/a&gt; or helpers within my &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;&lt;code&gt;dotfiles&lt;/code&gt;&lt;/a&gt;).&#10;These might have tens of dependencies.&#10;Because they are installed into isolated environments (often via &lt;a href="https://docs.astral.sh/uv/" target="_blank" rel="noopener"&gt;&lt;code&gt;uv&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://pipx.pypa.io/stable/" target="_blank" rel="noopener"&gt;&lt;code&gt;pipx&lt;/code&gt;&lt;/a&gt;, or within a dedicated &lt;code&gt;conda&lt;/code&gt; env), this complexity is okay.&#10;The risk is contained.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Developer Tools Welcome:&lt;/strong&gt; Productivity boosters like &lt;a href="https://beta.ruff.rs/docs/rules/" target="_blank" rel="noopener"&gt;&lt;code&gt;ruff&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://mypy.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;&lt;code&gt;mypy&lt;/code&gt;&lt;/a&gt;, etc., are fair game as development dependencies (&lt;a href="https://www.nijho.lt/post/best-python-dev-tooling/"&gt;My Python Project Toolkit&lt;/a&gt;).&#10;They don&amp;rsquo;t impact the end-user runtime (if packaged properly), so I am much more lenient with dev tools.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Focus on Functionality:&lt;/strong&gt; The goal is often to deliver features or solve a problem efficiently.&#10;Leveraging existing libraries, even those with dependencies, is usually faster and more robust than reimplementing complex logic.&#10;It usually makes more sense to use existing libraries.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;In this context, the focus changes from &lt;em&gt;minimizing external impact&lt;/em&gt; (libraries) to &lt;em&gt;maximizing internal capability and maintainability&lt;/em&gt; within a controlled scope (applications).&lt;/p&gt;&#10;&lt;h2 id="4-conclusion-not-hypocrisy-but-context-driven-strategy-"&gt;4. Conclusion: Not Hypocrisy, but Context-Driven Strategy 🙏 &lt;a class="anchor" href="#4-conclusion-not-hypocrisy-but-context-driven-strategy-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My approach to dependencies &lt;em&gt;is&lt;/em&gt; &amp;ldquo;it depends on the situation&amp;rdquo;.&#10;I&amp;rsquo;m stricter about dependencies for my libraries than for my applications or personal tools.&#10;I am cautious about adopting dependencies while actively producing them for others.&lt;/p&gt;&#10;&lt;p&gt;But I don&amp;rsquo;t see this as hypocrisy.&#10;It&amp;rsquo;s a practical approach based on different situations and goals:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Libraries (as Consumer):&lt;/strong&gt; Focus on keeping the software community stable and making things easy for users. Be conservative.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Libraries (as Producer):&lt;/strong&gt; Create software responsibly, following the same high standards you expect from others.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Applications:&lt;/strong&gt; Focus on adding features and developing quickly within separate environments. Be pragmatic.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Understanding the different risks and goals for each situation helps make good decisions about dependencies.&#10;It&amp;rsquo;s about choosing the right trade-offs for the specific situation, whether you&amp;rsquo;re building a foundational block for the community or a specific tool for a controlled environment.&lt;/p&gt;&#10;&lt;p&gt;How do you handle dependencies across different types of projects?&#10;Do you find yourself navigating similar questions?&#10;Share your thoughts!&lt;/p&gt;&#10;</description></item><item><title>Functions over classes? Why I prefer a simpler, functional style in Python 🐍</title><link>https://www.nijho.lt/post/functional-python/</link><pubDate>Mon, 14 Apr 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/functional-python/</guid><description>&lt;p&gt;Over years of building software, from scientific simulation tools like &lt;a href="https://github.com/python-adaptive/adaptive" target="_blank" rel="noopener"&gt;&lt;code&gt;Adaptive&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/pipefunc/pipefunc" target="_blank" rel="noopener"&gt;&lt;code&gt;pipefunc&lt;/code&gt;&lt;/a&gt; to package management packages like &lt;a href="https://github.com/basnijholt/unidep" target="_blank" rel="noopener"&gt;&lt;code&gt;unidep&lt;/code&gt;&lt;/a&gt;, I&amp;rsquo;ve found myself preferring a certain coding style: using small, focused functions more than large classes with complex internal state and deep inheritance hierarchies.&#10;This isn&amp;rsquo;t about dogma, but about a pragmatic approach that, in my experience, leads to code that is easier to understand, test, and maintain.&lt;/p&gt;&#10;&lt;p&gt;This post outlines why I lean towards this functional-inspired style in my Python projects, while still recognizing where classes are the right tool.&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-taming-complexity-avoiding-the-over-engineering-trap-"&gt;1. Taming Complexity: Avoiding the Over-Engineering Trap 🧠&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-the-power-of-small-focused-functions-"&gt;2. The Power of Small, Focused Functions 🎯&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-keeping-classes-simple--using-them-where-they-fit-"&gt;3. Keeping Classes Simple &amp;amp; Using Them Where They Fit 🛠️&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-the-testability-advantage-"&gt;4. The Testability Advantage ✅&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-its-about-pragmatism-not-dogma-"&gt;5. It&amp;rsquo;s About Pragmatism, Not Dogma 🙏&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="1-taming-complexity-avoiding-the-over-engineering-trap-"&gt;1. Taming Complexity: Avoiding the Over-Engineering Trap 🧠 &lt;a class="anchor" href="#1-taming-complexity-avoiding-the-over-engineering-trap-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of the biggest challenges in software development is managing complexity.&#10;As systems grow, keeping track of how different parts interact and understanding the internal state of objects can become a lot to keep track of mentally (high cognitive load).&lt;/p&gt;&#10;&lt;p&gt;I&amp;rsquo;ve often observed a pattern, especially when developers first start using object-oriented programming: the tendency to use classes &lt;em&gt;everywhere&lt;/em&gt;.&#10;This can lead to over-engineering – introducing many layers of inheritance, abstract base classes with only a single implementation, and generally creating complexity when simplicity would suffice.&#10;Thinking you&amp;rsquo;re being clever by building complex class structures can sometimes just be a form of overgeneralization that makes the code harder, not easier, to follow.&lt;/p&gt;&#10;&lt;p&gt;Classes, particularly those with many methods modifying internal attributes (&lt;code&gt;self.x&lt;/code&gt;, &lt;code&gt;self.y&lt;/code&gt;, etc.), require you to constantly hold their state in your head.&#10;When you call a method &lt;code&gt;object.do_something()&lt;/code&gt;, the outcome might depend not just on the arguments you pass, but also on the object&amp;rsquo;s history – what methods were called before, and in what order?&#10;This hidden state can make reasoning about the code&amp;rsquo;s behavior difficult and debugging tricky.&lt;/p&gt;&#10;&lt;p&gt;Functions, particularly when kept small and focused, tend to be more explicit.&#10;Ideally, a function takes inputs and produces outputs, with minimal side effects (or ideally, none - making them pure functions).&#10;Its behavior is primarily determined by its arguments.&#10;This makes the code flow easier to follow: data comes in, transformation happens, data goes out.&#10;There&amp;rsquo;s less hidden context to juggle mentally.&lt;/p&gt;&#10;&lt;h2 id="2-the-power-of-small-focused-functions-"&gt;2. The Power of Small, Focused Functions 🎯 &lt;a class="anchor" href="#2-the-power-of-small-focused-functions-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This leads directly to the preference for small functions, each doing one thing well (adhering to the Single Responsibility Principle).&#10;When functions are concise and have a clear purpose:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Readability Improves:&lt;/strong&gt; It&amp;rsquo;s easier to understand what a small, well-named function does quickly.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reusability Increases:&lt;/strong&gt; Small, focused functions are more likely to be reusable in different parts of the codebase or even in other projects.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Refactoring is Simpler:&lt;/strong&gt; Modifying or replacing a small unit of logic is less risky than altering a large, complex method within a class.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This philosophy is something I actively apply.&#10;Looking at the codebase for &lt;a href="https://github.com/basnijholt/unidep" target="_blank" rel="noopener"&gt;&lt;code&gt;unidep&lt;/code&gt;&lt;/a&gt;, for example, you&amp;rsquo;ll find many utility functions in modules like &lt;code&gt;_dependencies_parsing.py&lt;/code&gt; or &lt;code&gt;_conda_env.py&lt;/code&gt;, each handling a specific, well-defined task.&lt;/p&gt;&#10;&lt;h2 id="3-keeping-classes-simple--using-them-where-they-fit-"&gt;3. Keeping Classes Simple &amp;amp; Using Them Where They Fit 🛠️ &lt;a class="anchor" href="#3-keeping-classes-simple--using-them-where-they-fit-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;So, where do classes fit in this picture?&lt;/p&gt;&#10;&lt;p&gt;Firstly, as &lt;strong&gt;simple data structures&lt;/strong&gt; – think &lt;code&gt;NamedTuple&lt;/code&gt;s or &lt;code&gt;dataclasses&lt;/code&gt; (preferably with &lt;code&gt;frozen=True&lt;/code&gt;).&#10;Their main role is to group related data attributes together, providing a clear structure for passing information around.&#10;They hold data, but don&amp;rsquo;t typically manage complex state transitions.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Example of a simple data class from unidep&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;dataclasses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pathlib&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@dataclass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frozen&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# Use frozen=True for immutability&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;which&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Literal&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;conda&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pip&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;pin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;None&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# ... other simple attributes ...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Used to pass structured data, not to manage complex state&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_spec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Spec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# ... function logic using spec data ...&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;pass&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Secondly, and importantly, classes are excellent for &lt;strong&gt;defining user-facing APIs&lt;/strong&gt;.&#10;For the end-user of a library, having a single object with easily discoverable methods (&lt;code&gt;object.&amp;lt;tab&amp;gt;&lt;/code&gt;) is often a great user experience.&lt;/p&gt;&#10;&lt;p&gt;A good example from my own work is the &lt;a href="https://github.com/pipefunc/pipefunc" target="_blank" rel="noopener"&gt;&lt;code&gt;pipefunc&lt;/code&gt;&lt;/a&gt; package.&#10;It provides two main classes, &lt;code&gt;Pipeline&lt;/code&gt; and &lt;code&gt;PipeFunc&lt;/code&gt;, which encapsulate the core functionality.&#10;Users interact primarily with these objects and their methods.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Simplified example from pipefunc&amp;#39;s user perspective&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pipefunc&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Pipeline&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;pipeline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Pipeline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;pipeline&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;some_function&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;results&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pipeline&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;output_node&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;However, &lt;strong&gt;inside&lt;/strong&gt; the methods of these API classes (&lt;code&gt;Pipeline.run&lt;/code&gt;, &lt;code&gt;Pipeline.add&lt;/code&gt;, etc.), the actual logic is often delegated to smaller, internal functions.&#10;The class acts as a clean interface or facade, orchestrating calls to these more focused, functional units.&#10;This gives the user a nice API while keeping the internal implementation modular and testable.&lt;/p&gt;&#10;&lt;p&gt;I also actively avoid deep inheritance hierarchies.&#10;Composition (having objects contain other objects) often provides a more flexible and explicit way to combine functionality without the tight coupling and complexity inheritance can introduce.&lt;/p&gt;&#10;&lt;h2 id="4-the-testability-advantage-"&gt;4. The Testability Advantage ✅ &lt;a class="anchor" href="#4-the-testability-advantage-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of the most significant practical benefits of prioritizing functions and simple classes is testability.&#10;Small, pure (or mostly pure) functions are incredibly easy to test:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Provide known inputs.&lt;/li&gt;&#10;&lt;li&gt;Assert expected outputs.&lt;/li&gt;&#10;&lt;li&gt;Minimal setup or mocking is required because there&amp;rsquo;s no complex internal state to manage.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Even when testing the methods of the API classes (like &lt;code&gt;Pipeline&lt;/code&gt; in &lt;code&gt;pipefunc&lt;/code&gt;), the fact that they often delegate to well-tested internal functions simplifies the process.&#10;You focus on testing the orchestration and interaction logic at the class level, knowing the underlying functional units are already verified.&lt;/p&gt;&#10;&lt;p&gt;Testing classes with intricate internal state inherently involves more setup (instantiating the object, getting it into the right state before calling the method under test) and potentially more complex assertions to verify state changes.&#10;Aiming for more functional units significantly simplifies the testing process.&lt;/p&gt;&#10;&lt;h2 id="5-its-about-pragmatism-not-dogma-"&gt;5. It&amp;rsquo;s About Pragmatism, Not Dogma 🙏 &lt;a class="anchor" href="#5-its-about-pragmatism-not-dogma-" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This isn&amp;rsquo;t a wholesale rejection of object-oriented programming.&#10;It&amp;rsquo;s about choosing the right tool for the job and prioritizing clarity, testability, and maintainability.&#10;Classes are fantastic tools, especially for building clear APIs and structuring data.&#10;Deep inheritance and complex state management, however, should be used carefully, not just because the language allows it.&lt;/p&gt;&#10;&lt;p&gt;For much of the work I do – building libraries, tools, and performing data analysis or simulations – I&amp;rsquo;ve found that prioritizing functions, keeping API classes focused, minimizing internal state, and avoiding deep inheritance leads to code that &lt;em&gt;I&lt;/em&gt; find easier to write, understand, debug, and maintain in the long run.&#10;The reduction in cognitive load and the ease of testing are strong points for how I work.&lt;/p&gt;&#10;&lt;p&gt;If you often find yourself struggling with complex state management or tangled inheritance trees, perhaps consider if a simpler, more functional internal structure, potentially fronted by a clean class-based API, might bring some clarity and simplicity to your projects too.&lt;/p&gt;&#10;</description></item><item><title>Open-sourcing my dotfiles: a practical, cross-platform terminal setup 🏠</title><link>https://www.nijho.lt/post/dotfiles/</link><pubDate>Sat, 05 Apr 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/dotfiles/</guid><description>&lt;h2 id="introduction"&gt;Introduction &lt;a class="anchor" href="#introduction" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Many of us spend a significant amount of time in the terminal.&#10;Over the years, I&amp;rsquo;ve found that investing in a well-organized and consistent command-line environment pays dividends in productivity and, frankly, makes the daily grind more enjoyable.&#10;After refining my personal setup across more than 10 different machines – ranging from my primary MacBooks to Linux servers (x86/ARM), Raspberry Pis in my &lt;a href="https://www.nijho.lt/post/homelab/"&gt;homelab&lt;/a&gt;, cloud VMs, and even my iPhone via iSH – I&amp;rsquo;ve decided it&amp;rsquo;s time to share it publicly.&#10;The need for a consistent experience across such diverse hardware and operating systems was a major driving force behind this setup&amp;rsquo;s evolution.&lt;/p&gt;&#10;&lt;p&gt;Today, I&amp;rsquo;m open sourcing my complete &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;dotfiles repository&lt;/a&gt; 🎉.&#10;This isn&amp;rsquo;t about presenting a &amp;ldquo;perfect&amp;rdquo; solution, but rather sharing a practical system that has evolved to handle real-world needs like cross-platform consistency, easy setup on new machines, and integrating modern CLI tools effectively.&#10;If you&amp;rsquo;re looking for ideas to streamline your own terminal workflow, I hope you find something useful here.&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#why-open-source-now"&gt;Why Open Source Now?&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#core-ideas--highlights"&gt;Core Ideas &amp;amp; Highlights&lt;/a&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#1-cross-platform--shell-agnostic"&gt;1. Cross-Platform &amp;amp; Shell Agnostic&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#2-modularity-for-sanity"&gt;2. Modularity for Sanity&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#3-automation-via-dotbot"&gt;3. Automation via Dotbot&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#4-hassle-free-cli-tools-with-dotbins"&gt;4. Hassle-Free CLI Tools with &lt;code&gt;dotbins&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#5-sensible-ssh-key-management"&gt;5. Sensible SSH Key Management&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#6-macos-declarative-setup-with-nix-darwin"&gt;6. (macOS) Declarative Setup with Nix-Darwin&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10; &lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#a-note-on-alternatives--design-choices"&gt;A Note on Alternatives &amp;amp; Design Choices&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#a-look-inside-structure"&gt;A Look Inside: Structure&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#getting-started"&gt;Getting Started&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#a-note-on-secrets"&gt;A Note on Secrets&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#conclusion"&gt;Conclusion&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="why-open-source-now"&gt;Why Open Source Now? &lt;a class="anchor" href="#why-open-source-now" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I have maintained my dotfiles for many years in a private repository.&#10;Sharing this setup feels like a natural step for a few reasons:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Sharing Solutions:&lt;/strong&gt; This setup incorporates solutions to problems I&amp;rsquo;ve wrestled with, like managing binaries without &lt;code&gt;sudo&lt;/code&gt; (leading to my &lt;a href="https://github.com/basnijholt/dotbins" target="_blank" rel="noopener"&gt;&lt;code&gt;dotbins&lt;/code&gt;&lt;/a&gt; tool), achieving &lt;a href="https://www.nijho.lt/post/ssh-1password-funtoo-keychain/"&gt;consistent SSH agent behavior&lt;/a&gt;, or getting Python environments to activate seamlessly with &lt;a href="https://direnv.net/" target="_blank" rel="noopener"&gt;direnv&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Giving Back:&lt;/strong&gt; I&amp;rsquo;ve learned a lot from countless other dotfiles repos and articles shared by the community. It feels right to contribute my own approach.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Transparency &amp;amp; Learning:&lt;/strong&gt; Open sourcing allows others to see how different pieces fit together and perhaps adapt ideas for their own configurations.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;However, the driving force was the recent creation of my &lt;a href="https://www.nijho.lt/post/dotbins/"&gt;&lt;code&gt;dotbins&lt;/code&gt; tool&lt;/a&gt; and honestly, I just want to share &amp;ldquo;my way&amp;rdquo; of doing things.&lt;/p&gt;&#10;&lt;h2 id="core-ideas--highlights"&gt;Core Ideas &amp;amp; Highlights &lt;a class="anchor" href="#core-ideas--highlights" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My setup is built around a few key principles aimed at practicality and efficiency:&lt;/p&gt;&#10;&lt;h3 id="1-cross-platform--shell-agnostic"&gt;1. Cross-Platform &amp;amp; Shell Agnostic &lt;a class="anchor" href="#1-cross-platform--shell-agnostic" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;It&amp;rsquo;s designed to work reliably on macOS (&lt;code&gt;aarch64&lt;/code&gt;) and various Linux distros (&lt;code&gt;x86_64&lt;/code&gt;, &lt;code&gt;aarch64&lt;/code&gt;).&#10;While Zsh is my preference (leveraging &lt;a href="https://ohmyz.sh/" target="_blank" rel="noopener"&gt;Oh-My-Zsh&lt;/a&gt;), the core configurations in &lt;code&gt;configs/shell/&lt;/code&gt; are sourced by both &lt;code&gt;.zshrc&lt;/code&gt; and &lt;code&gt;.bash_profile&lt;/code&gt;, ensuring basic compatibility.&lt;/p&gt;&#10;&lt;h3 id="2-modularity-for-sanity"&gt;2. Modularity for Sanity &lt;a class="anchor" href="#2-modularity-for-sanity" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Instead of one giant config file, the shell setup is broken down logically:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;configs/shell/&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 00_prefer_zsh.sh &lt;span class="c1"&gt;# Switches Bash users to Zsh if available&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 10_aliases.sh &lt;span class="c1"&gt;# Common aliases&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 20_exports.sh &lt;span class="c1"&gt;# Environment variables&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 30_misc.sh &lt;span class="c1"&gt;# Dotbins init, secrets sourcing&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 40_keychain.sh &lt;span class="c1"&gt;# SSH agent setup (Keychain/1Password)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── 50_python.sh &lt;span class="c1"&gt;# Python env helpers (conda, uv, direnv)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ... and others for Zsh specifics, SLURM, etc.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── main.sh &lt;span class="c1"&gt;# Sources the relevant files above&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This makes it much easier to understand, maintain, and debug specific parts of the configuration. My actual &lt;code&gt;.zshrc&lt;/code&gt; and &lt;code&gt;.bash_profile&lt;/code&gt; just source &lt;code&gt;main.sh&lt;/code&gt;.&lt;/p&gt;&#10;&lt;h3 id="3-automation-via-dotbot"&gt;3. Automation via Dotbot &lt;a class="anchor" href="#3-automation-via-dotbot" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;The setup does not require &lt;code&gt;sudo&lt;/code&gt; access, and the installation process is entirely in the user&amp;rsquo;s home directory!&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;A core goal here is a true &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/install" target="_blank" rel="noopener"&gt;&lt;code&gt;./install&lt;/code&gt;&lt;/a&gt; and done setup.&#10;&lt;a href="https://github.com/anishathalye/dotbot" target="_blank" rel="noopener"&gt;Dotbot&lt;/a&gt; is key to this automation.&#10;Setting up a new machine or syncing changes is streamlined using this tool.&#10;The &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/install.conf.yaml" target="_blank" rel="noopener"&gt;&lt;code&gt;install.conf.yaml&lt;/code&gt;&lt;/a&gt; file defines which config files get symlinked where, &lt;em&gt;and&lt;/em&gt; runs initial setup commands.&#10;This includes updating submodules and, importantly, using &lt;code&gt;uv tool install&lt;/code&gt; to install a curated list of essential Python CLI tools (&lt;code&gt;ruff&lt;/code&gt;, &lt;code&gt;pre-commit&lt;/code&gt;, &lt;code&gt;dotbins&lt;/code&gt; itself, etc.) globally, ensuring they&amp;rsquo;re immediately available after installation.&#10;For remote machines, &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/scripts/sync-dotfiles.sh" target="_blank" rel="noopener"&gt;&lt;code&gt;scripts/sync-dotfiles.sh&lt;/code&gt;&lt;/a&gt; handles pulling updates and optionally re-running the install.&lt;/p&gt;&#10;&lt;h3 id="4-hassle-free-cli-tools-with-dotbins"&gt;4. Hassle-Free CLI Tools with &lt;code&gt;dotbins&lt;/code&gt; &lt;a class="anchor" href="#4-hassle-free-cli-tools-with-dotbins" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Modern CLI tools are fantastic, but installing them everywhere, especially without &lt;code&gt;sudo&lt;/code&gt;, can be a pain.&#10;I built &lt;a href="https://github.com/basnijholt/dotbins" target="_blank" rel="noopener"&gt;&lt;code&gt;dotbins&lt;/code&gt;&lt;/a&gt; to solve this.&#10;It downloads pre-compiled binaries for specified tools directly from GitHub releases, organizing them by platform/architecture.&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;# Snippet from ~/.dotbins/dotbins.yaml&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;dandavison/delta&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Git diff tool&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;eza&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;eza-community/eza&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Modern &amp;#39;ls&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;zoxide&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ajeetdsouza/zoxide&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Smarter &amp;#39;cd&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;starship&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;starship/starship&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Shell prompt&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;atuin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;atuinsh/atuin&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# Shell history sync&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="c"&gt;# ... plus tools with shell integration code&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The shell setup automatically adds the correct binary path and runs any needed initialization.&#10;More details in my &lt;a href="https://www.nijho.lt/post/dotbins/"&gt;&lt;code&gt;dotbins&lt;/code&gt; post&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h3 id="5-sensible-ssh-key-management"&gt;5. Sensible SSH Key Management &lt;a class="anchor" href="#5-sensible-ssh-key-management" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;Using &lt;a href="https://www.funtoo.org/Funtoo:Keychain" target="_blank" rel="noopener"&gt;Funtoo Keychain&lt;/a&gt;, often integrated with the 1Password CLI for passphrase retrieval, means I typically only deal with my SSH key passphrase once per login session.&#10;This setup is detailed &lt;a href="https://www.nijho.lt/post/ssh-1password-funtoo-keychain/"&gt;here&lt;/a&gt;.&lt;/p&gt;&#10;&lt;h3 id="6-macos-declarative-setup-with-nix-darwin"&gt;6. (macOS) Declarative Setup with Nix-Darwin &lt;a class="anchor" href="#6-macos-declarative-setup-with-nix-darwin" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;p&gt;On my Macs, I use &lt;a href="https://github.com/LnL7/nix-darwin" target="_blank" rel="noopener"&gt;Nix-Darwin&lt;/a&gt; to manage system settings and even Homebrew packages declaratively (&lt;code&gt;configs/nix-darwin/&lt;/code&gt;).&#10;Running &lt;code&gt;nixswitch&lt;/code&gt; applies the entire configuration, making macOS setups highly reproducible.&lt;/p&gt;&#10;&lt;h2 id="a-note-on-alternatives--design-choices"&gt;A Note on Alternatives &amp;amp; Design Choices &lt;a class="anchor" href="#a-note-on-alternatives--design-choices" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;You might wonder why I haven&amp;rsquo;t adopted certain popular tools or approaches. Here&amp;rsquo;s some rationale behind the choices made in this setup:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Why not &lt;code&gt;fish&lt;/code&gt; shell?&lt;/strong&gt; While &lt;code&gt;fish&lt;/code&gt; offers many appealing modern features (and &lt;a href="https://fishshell.com/blog/rustport/" target="_blank" rel="noopener"&gt;its Rust rewrite is intriguing&lt;/a&gt;!), a core requirement for my setup is broad compatibility. I need my core shell environment to function reliably even on minimal Linux systems (servers, containers, HPC nodes) where &lt;code&gt;bash&lt;/code&gt; is often the only guarantee. For this reason, I use &lt;code&gt;zsh&lt;/code&gt; as a powerful, yet largely POSIX-compatible, middle ground that works well across my diverse environments without requiring a non-standard shell installation everywhere.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Why iTerm2 on macOS?&lt;/strong&gt; I&amp;rsquo;ve experimented with newer terminals like WezTerm, Ghostty, Kitty, and Alacritty. Many offer benefits like impressive speed and GPU rendering. However, I consistently return to &lt;a href="https://iterm2.com/" target="_blank" rel="noopener"&gt;iTerm2&lt;/a&gt;.&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Criticisms &amp;amp; Rebuttals:&lt;/strong&gt; iTerm2 is often criticized for being &amp;ldquo;bloated&amp;rdquo; or &amp;ldquo;slow,&amp;rdquo; and historically, its settings weren&amp;rsquo;t easily version controllable. Frankly, on modern hardware, any perceived slowness is negligible for my use cases. More importantly, iTerm2 &lt;em&gt;does&lt;/em&gt; allow its profiles to be saved as JSON (see &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/configs/iterm/Profiles.json" target="_blank" rel="noopener"&gt;my &lt;code&gt;Profiles.json&lt;/code&gt;&lt;/a&gt; in this repo), making the configuration easily version controlled via dotfiles.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;The Killer Feature:&lt;/strong&gt; The primary reason I stick with iTerm2 is its robust &lt;strong&gt;Semantic History&lt;/strong&gt; feature. The ability to Cmd-Click URLs/filenames in terminal output – even complex ones with line numbers like &lt;code&gt;src/my_module/file.py:123&lt;/code&gt; – and have them open directly in VS Code at the correct line is indispensable for my debugging and development workflow. I haven&amp;rsquo;t found this replicated with the same reliability and ease of configuration elsewhere.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Other Features:&lt;/strong&gt; I also like simple features selecting text and (without &lt;code&gt;⌘+C&lt;/code&gt;!) pasting it right back into the terminal, and the window and tab management features.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Ghostty Example:&lt;/strong&gt; I recently tried Ghostty and liked many aspects, but quickly ran into limitations that highlighted my reliance on iTerm2 features, such as the lack of built-in text search, scrollbars, and crucially, the clickable file paths with line numbers (&lt;a href="https://bsky.app/profile/basnijholt.bsky.social/post/3lehtwv2pxc2j" target="_blank" rel="noopener"&gt;as discussed here&lt;/a&gt;).&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Why Dotbot/Git over &lt;code&gt;chezmoi&lt;/code&gt;?&lt;/strong&gt; &lt;a href="https://www.chezmoi.io/" target="_blank" rel="noopener"&gt;Chezmoi&lt;/a&gt; is a very popular and powerful dotfiles manager, often praised for its templating and management features. However, I prefer the directness of using &lt;code&gt;git&lt;/code&gt; for version control and Dotbot for simple symlinking. My setup &lt;em&gt;is&lt;/em&gt; the Git repository, which feels intuitive. Crucially, I rely heavily on &lt;strong&gt;Git submodules&lt;/strong&gt; (perhaps Git&amp;rsquo;s least loved feature 🤔) to manage external tools and plugins directly within my dotfiles repo. This submodule-centric approach integrates seamlessly with a standard Git workflow, which made Dotbot a more natural fit for me than chezmoi&amp;rsquo;s model.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;No &lt;code&gt;sudo&lt;/code&gt; Required:&lt;/strong&gt; A key design principle is that the installation process via &lt;code&gt;./install&lt;/code&gt; (Dotbot symlinking, &lt;code&gt;uv tool install&lt;/code&gt;, &lt;code&gt;dotbins&lt;/code&gt; fetching binaries) operates &lt;em&gt;entirely within the user&amp;rsquo;s home directory&lt;/em&gt;. No &lt;code&gt;sudo&lt;/code&gt; access is needed to get the core environment up and running. This makes the setup viable in restricted environments like HPC clusters, shared servers, or locked-down corporate machines where admin rights aren&amp;rsquo;t available.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="a-look-inside-structure"&gt;A Look Inside: Structure &lt;a class="anchor" href="#a-look-inside-structure" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The repository is organized to keep things separated logically:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;.&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── configs/ &lt;span class="c1"&gt;# Configs (atuin, bash, git, nix, shell, zsh...)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── install &lt;span class="c1"&gt;# Main installation script (runs dotbot)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── install.conf.yaml &lt;span class="c1"&gt;# Dotbot: Links configs, runs setup commands&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── scripts/ &lt;span class="c1"&gt;# Utility scripts (syncing, backups, helpers)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;├── submodules/ &lt;span class="c1"&gt;# External tools managed as submodules (dotbot, dotbins, plugins...)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;└── README.md &lt;span class="c1"&gt;# Detailed overview&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="getting-started"&gt;Getting Started &lt;a class="anchor" href="#getting-started" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;If you want to try this setup or adapt parts of it:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt; &lt;code&gt;git&lt;/code&gt; is essential. SSH access to GitHub is needed if you fork and want to manage the private &lt;code&gt;secrets&lt;/code&gt; submodule or other private submodules.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Clone:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Clone recursively to get submodules&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone --recurse-submodules -j8 git@github.com:basnijholt/dotfiles.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; dotfiles&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Install:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;./install&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This single command runs Dotbot, which handles creating configuration symlinks, updating Git submodules, &lt;em&gt;and&lt;/em&gt; installing numerous Python tools via &lt;code&gt;uv&lt;/code&gt; (as defined in &lt;code&gt;install.conf.yaml&lt;/code&gt;).&#10;Combined with &lt;code&gt;dotbins&lt;/code&gt; automatically fetching other pre-compiled binaries, your environment should be remarkably complete after this step.&#10;Restart your shell after it finishes.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;⚠️ Important: Customize!&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Fork the repository first!&lt;/strong&gt; Don&amp;rsquo;t use my configuration directly, especially &lt;code&gt;configs/git/gitconfig&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;Update &lt;code&gt;configs/git/gitconfig&lt;/code&gt; with &lt;em&gt;your&lt;/em&gt; name and email.&lt;/li&gt;&#10;&lt;li&gt;Review &lt;code&gt;install.conf.yaml&lt;/code&gt; – remove links or shell commands you don&amp;rsquo;t need. You can see the full list of Python tools installed via &lt;code&gt;uv&lt;/code&gt; &lt;a href="https://github.com/basnijholt/dotfiles/blob/main/install.conf.yaml" target="_blank" rel="noopener"&gt;here&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;Modify &lt;code&gt;configs/shell/&lt;/code&gt; files to suit your workflow.&lt;/li&gt;&#10;&lt;li&gt;Adjust the &lt;code&gt;dotbins&lt;/code&gt; configuration (&lt;code&gt;submodules/dotbins/dotbins.yaml&lt;/code&gt;) to include &lt;em&gt;your&lt;/em&gt; favorite tools.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="a-note-on-secrets"&gt;A Note on Secrets &lt;a class="anchor" href="#a-note-on-secrets" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Sensitive information (API keys, etc.) is &lt;em&gt;not&lt;/em&gt; stored directly in the public repository.&#10;I use a private Git repository included as a submodule (&lt;code&gt;secrets/&lt;/code&gt;).&#10;This requires SSH authentication.&#10;Within that private repo, I use &lt;code&gt;gpg&lt;/code&gt; and &lt;a href="https://github.com/sobolevn/git-secret" target="_blank" rel="noopener"&gt;git-secret&lt;/a&gt; to encrypt sensitive files, adding another layer of security.&#10;You&amp;rsquo;ll need your own strategy for managing secrets, whether it&amp;rsquo;s a similar private repo, environment variables, or a dedicated secrets manager.&lt;/p&gt;&#10;&lt;h2 id="conclusion"&gt;Conclusion &lt;a class="anchor" href="#conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This dotfiles setup represents my ongoing effort to build a productive, consistent, and enjoyable terminal environment across a diverse range of machines – from personal laptops to &lt;a href="https://www.nijho.lt/post/homelab/"&gt;homelab servers&lt;/a&gt; and cloud instances.&#10;It solves real problems I&amp;rsquo;ve encountered in maintaining that consistency.&#10;By sharing it, I hope to offer some practical ideas and perhaps save others some time in crafting their own ideal setup.&lt;/p&gt;&#10;&lt;p&gt;Feel free to explore the &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;repository&lt;/a&gt;, borrow what you find useful, and adapt it to your needs.&#10;If you find it helpful, consider giving it a star!&#10;If you have suggestions or find issues, contributions are welcome!&lt;/p&gt;&#10;&lt;p&gt;Happy terminal tinkering!&lt;/p&gt;&#10;&lt;hr&gt;&#10;&lt;p&gt;&lt;strong&gt;Further Reading &amp;amp; Links:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;My Dotfiles Repository on GitHub&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;Blog Post: &lt;a href="https://www.nijho.lt/post/homelab/"&gt;My Homelab Setup&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;Blog Post: &lt;a href="https://www.nijho.lt/post/terminal-ninja/"&gt;Be a Ninja in the Terminal 🥷&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;Blog Post: &lt;a href="https://www.nijho.lt/post/dotbins/"&gt;dotbins: Managing Binary Tools in Your Dotfiles 🧰&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;Blog Post: &lt;a href="https://www.nijho.lt/post/ssh-1password-funtoo-keychain/"&gt;Combining Keychain and 1Password CLI for SSH Agent Management&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/anishathalye/dotbot" target="_blank" rel="noopener"&gt;Dotbot&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/basnijholt/dotbins" target="_blank" rel="noopener"&gt;Dotbins&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://github.com/sobolevn/git-secret" target="_blank" rel="noopener"&gt;Git Secret&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://iterm2.com/" target="_blank" rel="noopener"&gt;iTerm2&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>Combining Keychain and 1Password CLI for ssh-agent management</title><link>https://www.nijho.lt/post/ssh-1password-funtoo-keychain/</link><pubDate>Sun, 30 Mar 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/ssh-1password-funtoo-keychain/</guid><description>&lt;h2 id="combining-keychain-and-1password-cli-for-ssh-agent-management"&gt;Combining Keychain and 1Password CLI for SSH Agent Management &lt;a class="anchor" href="#combining-keychain-and-1password-cli-for-ssh-agent-management" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For about a decade, I&amp;rsquo;ve relied on two key tools in my development workflow: &lt;a href="https://www.funtoo.org/Funtoo:Keychain" target="_blank" rel="noopener"&gt;Funtoo Keychain&lt;/a&gt; for managing my &lt;code&gt;ssh-agent&lt;/code&gt; and 1Password for securely storing secrets.&#10;While I used them extensively, I never actually integrated them directly for SSH key passphrase handling.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;I wrote about Keychain before in &lt;a href="../terminal-ninja/#-keychain-ssh-key-management-made-simple"&gt;this post&lt;/a&gt;.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;Recently, with the advent of &lt;a href="https://developer.1password.com/docs/ssh/get-started/" target="_blank" rel="noopener"&gt;1Password&amp;rsquo;s built-in SSH agent&lt;/a&gt;, I gave it a try, attracted by the promise of managing keys directly within my vault.&#10;However, I quickly found myself frequently prompted for my master password or biometrics, which interrupted my flow more often than I preferred compared to Keychain&amp;rsquo;s persistence.&lt;/p&gt;&#10;&lt;p&gt;This led me back to the reliable &amp;ldquo;unlock once per session&amp;rdquo; behavior of Keychain.&#10;But the experience using the 1Password Command-Line Interface (&lt;code&gt;op&lt;/code&gt;) during that time sparked an idea: could I combine the persistence of Keychain with the secure passphrase retrieval of the &lt;code&gt;op&lt;/code&gt; CLI?&#10;The answer is yes, and this post outlines the setup that achieves that balance.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The Goal:&lt;/strong&gt; Use 1Password as the secure vault for the SSH key passphrase but rely on &lt;code&gt;keychain&lt;/code&gt; to manage the &lt;code&gt;ssh-agent&lt;/code&gt; process and ensure the key, once unlocked, remains available for the entire login session without further prompts from 1Password.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Requires 1Password CLI (&lt;code&gt;op&lt;/code&gt;) and Funtoo Keychain installed.&#10;This post assumes you &lt;a href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key" target="_blank" rel="noopener"&gt;have a working SSH key&lt;/a&gt; and a &lt;a href="https://developer.1password.com/docs/cli/get-started/" target="_blank" rel="noopener"&gt;1Password with the CLI installed and authenticated&lt;/a&gt;.&#10;Run &lt;code&gt;brew install --cask 1password-cli&lt;/code&gt; and &lt;code&gt;brew install keychain&lt;/code&gt; to install them.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;&lt;strong&gt;Why This Approach?&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;This setup directly addresses the trade-off I encountered.&#10;Funtoo &lt;code&gt;keychain&lt;/code&gt; excels at starting &lt;code&gt;ssh-agent&lt;/code&gt; reliably on login and keeping keys available throughout a session with just one initial unlock.&#10;While the native 1Password agent is convenient for vault integration, its session management, in my experience, led to more frequent authentication prompts than desired for long-running sessions.&lt;/p&gt;&#10;&lt;p&gt;By using &lt;code&gt;keychain&lt;/code&gt; for agent management and calling the &lt;code&gt;op&lt;/code&gt; CLI via the standard &lt;code&gt;SSH_ASKPASS&lt;/code&gt; mechanism &lt;em&gt;only&lt;/em&gt; for the initial key load, we get the best of both worlds: 1Password&amp;rsquo;s secure storage for the passphrase and Keychain&amp;rsquo;s persistent agent access with minimal prompting after the first unlock.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The Components:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;strong&gt;Funtoo &lt;code&gt;keychain&lt;/code&gt;:&lt;/strong&gt; Manages &lt;code&gt;ssh-agent&lt;/code&gt; lifecycle and loads specified keys.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;1Password CLI (&lt;code&gt;op&lt;/code&gt;):&lt;/strong&gt; Securely retrieves secrets (the passphrase) from your 1Password vault. Requires &lt;code&gt;op&lt;/code&gt; to be installed and logged in.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;askpass-1password.sh&lt;/code&gt;:&lt;/strong&gt; A small helper script that &lt;code&gt;ssh-add&lt;/code&gt; (via &lt;code&gt;keychain&lt;/code&gt;) calls to get the passphrase. This script invokes &lt;code&gt;op&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;code&gt;setup_ssh_agent.sh&lt;/code&gt;:&lt;/strong&gt; A script sourced by your shell startup file (&lt;code&gt;.zshrc&lt;/code&gt;, &lt;code&gt;.bashrc&lt;/code&gt;, etc.) to orchestrate the setup.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;Step 1: Create the &lt;code&gt;askpass&lt;/code&gt; Helper Script&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;This script simply calls &lt;code&gt;op read&lt;/code&gt; to fetch the passphrase using its &lt;a href="https://developer.1password.com/docs/cli/secret-reference-syntax/" target="_blank" rel="noopener"&gt;Secret Reference URI&lt;/a&gt;.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://developer.1password.com/img/cli/copy-secret-reference-dark.png" alt="Copy Secret Reference screenshot" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;ul&gt;&#10;&lt;li&gt;Find your SSH key item in 1Password.&lt;/li&gt;&#10;&lt;li&gt;Locate the passphrase field, click the options/arrow, and copy the &amp;ldquo;Copy Secret Reference&amp;rdquo;.&lt;/li&gt;&#10;&lt;li&gt;Create the script at &lt;code&gt;~/.ssh/askpass-1password.sh&lt;/code&gt;:&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh" data-lang="sh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ~/.ssh/askpass-1password.sh&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Provides the SSH key passphrase from 1Password CLI via SSH_ASKPASS&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Paste your Secret Reference URI here&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;OP_SECRET_REFERENCE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;op://YourVault/YourSSHKeyItem/password&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Use &amp;#39;op read&amp;#39; to retrieve and print the passphrase to stdout&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Requires 1Password CLI (&amp;#39;op&amp;#39;) to be installed and authenticated.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;op &lt;span class="nb"&gt;read&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$OP_SECRET_REFERENCE&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#10;&lt;li&gt;Make it executable: &lt;code&gt;chmod u+x ~/.ssh/askpass-1password.sh&lt;/code&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;&lt;strong&gt;Step 2: Create the Setup Orchestration Script&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;This script checks if &lt;code&gt;op&lt;/code&gt; is available and conditionally configures &lt;code&gt;keychain&lt;/code&gt; to use the helper script.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;(Adjust path &lt;code&gt;~/dotfiles/scripts/setup_ssh_agent.sh&lt;/code&gt; as needed)&lt;/em&gt;&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="cp"&gt;#!/bin/zsh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# ~/dotfiles/scripts/setup_ssh_agent.sh - Sets up ssh-agent via keychain.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# If &amp;#39;op&amp;#39; CLI and the askpass helper script are available, uses 1Password for passphrase.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Intended to be sourced by .zshrc or similar.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_askpass_helper&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/.ssh/askpass-1password.sh&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_askpass_vars_set&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;false&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Check if &amp;#39;op&amp;#39; CLI is installed and the helper script is usable&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v op &amp;gt;/dev/null 2&amp;gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; -f &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$_askpass_helper&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; -x &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$_askpass_helper&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Configure environment for 1Password helper script&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;SSH_ASKPASS&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$_askpass_helper&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;SSH_ASKPASS_REQUIRE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;prefer&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# Use ASKPASS even in terminals&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nv"&gt;_askpass_vars_set&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Execute keychain to start/find agent, load key, and set env vars&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# (Adjust key name &amp;#39;id_ed25519&amp;#39; as needed)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;keychain --eval --quiet --agents ssh --inherit any-once id_ed25519&lt;span class="k"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Clean up ASKPASS variables if they were set&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nv"&gt;$_askpass_vars_set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;unset&lt;/span&gt; SSH_ASKPASS&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;unset&lt;/span&gt; SSH_ASKPASS_REQUIRE&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Step 3: Source the Setup Script in &lt;code&gt;.zshrc&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;Add this to your &lt;code&gt;~/.zshrc&lt;/code&gt; (or equivalent):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-zsh" data-lang="zsh"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# --- SSH Agent Configuration (via keychain &amp;amp; 1Password) ---&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Source the dedicated setup script if it exists.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;_ssh_setup_script&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/dotfiles/scripts/setup_ssh_agent.sh&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; -f &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$_ssh_setup_script&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;source&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$_ssh_setup_script&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# --- End SSH Agent Configuration ---&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;When you start a new shell session, &lt;code&gt;.zshrc&lt;/code&gt; sources &lt;code&gt;setup_ssh_agent.sh&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;The script checks if &lt;code&gt;op&lt;/code&gt; is installed and the &lt;code&gt;askpass-1password.sh&lt;/code&gt; helper is ready.&lt;/li&gt;&#10;&lt;li&gt;If yes, it sets the &lt;code&gt;SSH_ASKPASS&lt;/code&gt; and &lt;code&gt;SSH_ASKPASS_REQUIRE&lt;/code&gt; environment variables.&lt;/li&gt;&#10;&lt;li&gt;It runs &lt;code&gt;keychain --eval id_ed25519&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;keychain&lt;/code&gt; starts or connects to &lt;code&gt;ssh-agent&lt;/code&gt; and uses &lt;code&gt;ssh-add&lt;/code&gt; to load &lt;code&gt;id_ed25519&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ssh-add&lt;/code&gt; sees &lt;code&gt;SSH_ASKPASS&lt;/code&gt; is set and executes &lt;code&gt;askpass-1password.sh&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;The helper script runs &lt;code&gt;op read ...&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;The 1Password CLI handles authentication (prompting for your master password or using biometrics/system auth &lt;em&gt;if necessary&lt;/em&gt; based on its current session state – typically only if the &lt;code&gt;op&lt;/code&gt; session has expired).&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;op read&lt;/code&gt; outputs the passphrase.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ssh-add&lt;/code&gt; receives the passphrase and unlocks the key, adding it to the agent.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;keychain --eval&lt;/code&gt; outputs the necessary &lt;code&gt;export SSH_AUTH_SOCK=...&lt;/code&gt; commands.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;eval&lt;/code&gt; executes these commands, configuring your current shell to use the agent.&lt;/li&gt;&#10;&lt;li&gt;The &lt;code&gt;ASKPASS&lt;/code&gt; variables are unset.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;After years of using Funtoo Keychain and 1Password separately, and a brief foray into the native 1Password agent, this combined approach hits the sweet spot for me.&#10;It leverages 1Password&amp;rsquo;s secure vault for storing the SSH key passphrase but restores the &amp;ldquo;unlock once per session&amp;rdquo; convenience I appreciate from &lt;code&gt;keychain&lt;/code&gt;.&#10;It requires a single passphrase entry via 1Password when the key is first added (typically on login/boot), after which the key remains available via the standard &lt;code&gt;ssh-agent&lt;/code&gt; mechanism without further 1Password interaction for that session.&lt;/p&gt;&#10;</description></item><item><title>My LLM workflow: local frontends, (mostly) remote models 💻</title><link>https://www.nijho.lt/post/using-llms/</link><pubDate>Fri, 07 Mar 2025 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/using-llms/</guid><description>&lt;h1 id="how-i-use-llms-in-my-daily-workflow"&gt;How I Use LLMs in My Daily Workflow&lt;/h1&gt;&#10;&lt;p&gt;Over the past 1.5 years, I&amp;rsquo;ve developed a workflow for integrating Large Language Models into my daily life, particularly for open source software development.&#10;I wanted to share my setup and recent discoveries that have improved my experience.&#10;Setting it up takes a little technical know-how, but once it&amp;rsquo;s up and running, using it is easy, my wife even uses it!&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;tl;dr: I use &lt;a href="https://www.librechat.ai/" target="_blank" rel="noopener"&gt;LibreChat&lt;/a&gt;, with &lt;a href="https://openrouter.ai/" target="_blank" rel="noopener"&gt;OpenRouter&lt;/a&gt;, and &lt;a href="https://github.com/basnijholt/clip-files" target="_blank" rel="noopener"&gt;&lt;code&gt;clip-files&lt;/code&gt;&lt;/a&gt;, and currently Claude 3.7 is my favorite model.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="my-golden-rule-for-ai-generated-code"&gt;My Golden Rule for AI-Generated Code &lt;a class="anchor" href="#my-golden-rule-for-ai-generated-code" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;While AI can generate impressive amounts of code quickly, I follow one critical principle in my workflow: &lt;strong&gt;I never commit code I don&amp;rsquo;t fully understand&lt;/strong&gt;.&#10;With the ease of generating solutions comes the responsibility to ensure quality and correctness.&lt;/p&gt;&#10;&lt;p&gt;My approach involves:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Understanding every line&lt;/strong&gt;: Before committing any AI-generated code, I carefully review and understand each line. This helps avoid introducing subtle bugs that might be hidden in seemingly working code.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;100% test coverage&lt;/strong&gt;: I ensure comprehensive test coverage for AI-generated implementations. This serves two purposes: it verifies the code works as expected and creates concrete examples that document the intended behavior.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Critical evaluation&lt;/strong&gt;: I assess whether the proposed solution aligns with project architecture and best practices. Often, I&amp;rsquo;ll ask the AI to refactor or explain its approach before accepting it.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Incremental adoption&lt;/strong&gt;: Rather than accepting large code blocks wholesale, I typically integrate smaller, well-understood portions that can be thoroughly tested.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This mindset transforms AI from a potential shortcut that could introduce technical debt into a powerful assistant that accelerates development while maintaining quality standards.&lt;/p&gt;&#10;&lt;h2 id="starting-with-openwebui"&gt;Starting with OpenWebUI &lt;a class="anchor" href="#starting-with-openwebui" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For most of the last year, I&amp;rsquo;ve relied on &lt;a href="https://openwebui.com/" target="_blank" rel="noopener"&gt;OpenWebUI&lt;/a&gt; as my primary interface for accessing various commercial LLMs:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;OpenAI&amp;rsquo;s models&lt;/li&gt;&#10;&lt;li&gt;Anthropic&amp;rsquo;s Claude models&lt;/li&gt;&#10;&lt;li&gt;Google&amp;rsquo;s Gemini models&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;OpenWebUI is primarily designed for running local models, but it can work with remote APIs through what it calls &lt;a href="https://openwebui.com/functions" target="_blank" rel="noopener"&gt;&amp;ldquo;functions&amp;rdquo;&lt;/a&gt; - essentially Python modules that establish connections to these external APIs.&#10;While functional, this approach requires additional setup and configuration to get working properly.&lt;/p&gt;&#10;&lt;h2 id="discovering-librechat-a-major-upgrade"&gt;Discovering LibreChat: A Major Upgrade &lt;a class="anchor" href="#discovering-librechat-a-major-upgrade" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Recently, I discovered &lt;a href="https://www.librechat.ai/" target="_blank" rel="noopener"&gt;LibreChat&lt;/a&gt;, which has dramatically improved my LLM experience:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Speed&lt;/strong&gt;: Pages load in under a second, compared to 5-10 seconds with OpenWebUI.&#10;This performance difference is especially noticeable when accessing either interface from my iPhone.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;API Support&lt;/strong&gt;: Native integration with virtually all major AI company APIs you can think of, right out of the box&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Convenience&lt;/strong&gt;: No need to implement custom Python functions - all popular models are supported by default&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Reasoning Support&lt;/strong&gt;: LibreChat works much better with the new reasoning models, properly placing the reasoning part of replies in a dropdown.&#10;The amount of reasoning tokens is also easily parameterized.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="the-rise-of-free--nearly-free-powerful-models"&gt;The Rise of Free &amp;amp; Nearly-Free Powerful Models &lt;a class="anchor" href="#the-rise-of-free--nearly-free-powerful-models" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The landscape has changed dramatically in just the last month.&#10;Several extremely capable models are now either completely free or essentially free:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Google&amp;rsquo;s &lt;a href="https://ai.google.dev/gemini-api/docs/models/experimental-models" target="_blank" rel="noopener"&gt;gemini-exp-1206&lt;/a&gt;&lt;/strong&gt;: Impressively capable with a huge context window for code&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://www.deepseek.com/" target="_blank" rel="noopener"&gt;DeepSeek&lt;/a&gt;&lt;/strong&gt;: DeepSeek v3 is one of the best in this category, offering remarkable performance at minimal cost&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;&lt;a href="https://huggingface.co/Qwen/QwQ-32B-Preview" target="_blank" rel="noopener"&gt;Qwen QwQ 32B&lt;/a&gt;&lt;/strong&gt;: Another powerful option that won&amp;rsquo;t break the bank&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;This democratization of access to high-quality models has substantially improved my development workflow.&lt;/p&gt;&#10;&lt;h2 id="claude-37-worth-every-penny"&gt;Claude 3.7: Worth Every Penny &lt;a class="anchor" href="#claude-37-worth-every-penny" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;My current go-to model is Anthropic&amp;rsquo;s Claude 3.7.&#10;I&amp;rsquo;m completely blown away by its capabilities and find myself happy to pay the premium price for what it delivers.&#10;The quality of responses, understanding of complex contexts, and overall reliability have made it an indispensable tool in my workflow.&lt;/p&gt;&#10;&lt;h2 id="openrouter-hundreds-of-models-one-api"&gt;OpenRouter: Hundreds of Models, One API &lt;a class="anchor" href="#openrouter-hundreds-of-models-one-api" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;A particularly valuable discovery has been &lt;a href="https://openrouter.ai/" target="_blank" rel="noopener"&gt;OpenRouter.ai&lt;/a&gt;.&#10;With just one API key, I can access hundreds of different models, many of which are completely free to use.&#10;This has dramatically expanded my toolkit without increasing costs.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Note that OpenRouter doesn&amp;rsquo;t charge anything extra for using their interface, however, they very likely keep your data.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="easy-deployment-with-docker-compose"&gt;Easy Deployment with Docker Compose &lt;a class="anchor" href="#easy-deployment-with-docker-compose" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Both OpenWebUI and LibreChat are extremely easy to deploy using Docker Compose.&#10;As someone who self-hosts numerous services, I appreciate how straightforward it is to get either of these interfaces up and running with a simple docker-compose file.&#10;This accessibility makes it easy for even those with limited server experience to set up their own LLM workstation.&lt;/p&gt;&#10;&lt;h2 id="why-i-dont-run-local-models"&gt;Why I Don&amp;rsquo;t Run Local Models &lt;a class="anchor" href="#why-i-dont-run-local-models" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Despite being a self-hosting enthusiast (I run over 50 services at home!), I&amp;rsquo;ve stuck with commercial API models for my work.&#10;Since I mainly develop open source software, data privacy concerns are minimal—the code I work with is already publicly available.&#10;The commercial models also provide superior performance for my specific needs.&lt;/p&gt;&#10;&lt;h2 id="avoiding-web-interfaces--subscriptions"&gt;Avoiding Web Interfaces &amp;amp; Subscriptions &lt;a class="anchor" href="#avoiding-web-interfaces--subscriptions" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I deliberately avoid using ChatGPT or Claude through their native web interfaces.&#10;Why? Simple economics.&#10;By accessing these models through my own interfaces with API keys, I don&amp;rsquo;t have to pay separate subscription fees (≈$20) for each service.&#10;This consolidated approach saves money while providing more flexibility.&lt;/p&gt;&#10;&lt;h2 id="code-editor-experiments"&gt;Code Editor Experiments &lt;a class="anchor" href="#code-editor-experiments" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I&amp;rsquo;ve tried &lt;a href="https://www.cursor.com/" target="_blank" rel="noopener"&gt;Cursor editor&lt;/a&gt;, which offers an interesting AI-integrated coding experience.&#10;While many features are impressive, I encountered limitations—particularly with the Python debugger, which is &lt;a href="https://forum.cursor.com/t/python-debugger-doesnt-launch/1661/19" target="_blank" rel="noopener"&gt;a known issue&lt;/a&gt;.&#10;Despite its promise, these limitations pushed me back to my custom workflow.&lt;/p&gt;&#10;&lt;h2 id="my-diy-solution-clip-files"&gt;My DIY Solution: clip-files &lt;a class="anchor" href="#my-diy-solution-clip-files" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;To compensate, I heavily rely on a CLI tool I created called &amp;ldquo;&lt;a href="https://github.com/basnijholt/clip-files/" target="_blank" rel="noopener"&gt;clip-files&lt;/a&gt;.&amp;rdquo; This simple utility lets me pass filenames as arguments, and it copies their contents to my clipboard along with useful metadata.&#10;This makes it effortless to share code with LLMs regardless of which interface I&amp;rsquo;m using—simple, fast, and effective.&#10;Together with the &lt;a href="https://github.com/zsh-users/zsh-autosuggestions" target="_blank" rel="noopener"&gt;&lt;code&gt;zsh-autosuggestions&lt;/code&gt;&lt;/a&gt; plugin–which I talked about in &lt;a href="../terminal-ninja/"&gt;another post&lt;/a&gt;–generating the right prompt is a breeze.&lt;/p&gt;&#10;&lt;h2 id="my-current-setup"&gt;My Current Setup &lt;a class="anchor" href="#my-current-setup" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Today, I maintain access to multiple top-tier models through LibreChat&amp;rsquo;s interface and OpenRouter.ai&amp;rsquo;s API.&#10;This gives me flexibility to choose the right model for specific tasks while enjoying a responsive, feature-rich environment without unnecessary subscription costs.&lt;/p&gt;&#10;&lt;p&gt;For fellow self-hosters and developers looking to optimize their LLM workflow, I highly recommend this combination, especially if you&amp;rsquo;re currently using web interfaces or struggling with OpenWebUI&amp;rsquo;s performance.&lt;/p&gt;&#10;&lt;p&gt;What LLM setups are you using in your workflow? I&amp;rsquo;d love to hear about your experiences in the comments!&lt;/p&gt;&#10;</description></item><item><title>Friend‑to‑friend TrueNAS backups without the cloud</title><link>https://www.nijho.lt/post/truenas-remote-backups/</link><pubDate>Sat, 24 Aug 2024 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/truenas-remote-backups/</guid><description>&lt;h2 id="the-challenge-escaping-the-cloud"&gt;The Challenge: Escaping the Cloud &lt;a class="anchor" href="#the-challenge-escaping-the-cloud" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;I recently wrote about my &lt;a href="https://www.nijho.lt/post/homelab/"&gt;homelab&lt;/a&gt; and how I use TrueNAS on my NAS for data storage.&#10;Most self-hosters are looking for ways to &amp;ldquo;de-cloud&amp;rdquo; themselves, taking control of their data away from big tech companies, and reducing monthly subscription fees.&#10;One subscription cost that many of us still rely on is cloud storage for backups.&#10;Personally, I use Rclone to back up my most essential data to Backblaze B2, but now that my data is growing, I&amp;rsquo;m looking for a more cost-effective solution.&lt;/p&gt;&#10;&lt;p&gt;Luckily, I have a friend who also uses TrueNAS and is looking for a similar solution.&lt;/p&gt;&#10;&lt;p&gt;TrueNAS offers built-in replication tasks that allow us to efficiently replicate our data to another TrueNAS system.&#10;Unfortunately, this requires root access to the remote system, which is a security risk neither of us are willing to take&lt;/p&gt;&#10;&lt;p&gt;So, how can we set up remote ZFS replication with a friend, maintaining our de-clouded status, without compromising the security of our TrueNAS systems?&lt;/p&gt;&#10;&lt;h2 id="the-requirements"&gt;The Requirements &lt;a class="anchor" href="#the-requirements" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Use TrueNAS&amp;rsquo;s built-in replication tasks (uses &lt;code&gt;zfs send&lt;/code&gt; and &lt;code&gt;zfs receive&lt;/code&gt; for efficient replication, which is significantly faster than &lt;code&gt;rsync&lt;/code&gt;)&lt;/li&gt;&#10;&lt;li&gt;Replicate to a friend&amp;rsquo;s system with ZFS capabilities&lt;/li&gt;&#10;&lt;li&gt;Avoid granting root access to each other&amp;rsquo;s TrueNAS systems&lt;/li&gt;&#10;&lt;li&gt;Maintain control over the allocated backup space&lt;/li&gt;&#10;&lt;li&gt;Keep our data private and out of corporate clouds&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="the-solution-truenas-vm-on-hypervisor-and-iscsi-backup-storage-on-truenas"&gt;The Solution: TrueNAS VM on hypervisor and iSCSI Backup Storage on TrueNAS &lt;a class="anchor" href="#the-solution-truenas-vm-on-hypervisor-and-iscsi-backup-storage-on-truenas" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;After exploring various options, we&amp;rsquo;ve found a secure and efficient solution using a hybrid VM setup that keeps us firmly in control of our data. Here&amp;rsquo;s the high-level overview:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Deploy a TrueNAS VM on a local hypervisor (e.g., Proxmox), running independently of your main TrueNAS system&lt;/li&gt;&#10;&lt;li&gt;Set up an iSCSI target on your TrueNAS for backup storage&lt;/li&gt;&#10;&lt;li&gt;Connect the iSCSI target as an additional disk to the VM and format it with ZFS&lt;/li&gt;&#10;&lt;li&gt;Give your friend secure access to this VM&lt;/li&gt;&#10;&lt;li&gt;Your friend sets up replication tasks to this VM&amp;rsquo;s iSCSI-connected storage&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="why-this-works"&gt;Why This Works &lt;a class="anchor" href="#why-this-works" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Security&lt;/strong&gt;: No need for root access on each other&amp;rsquo;s TrueNAS systems and data can be encrypted on the iSCSI storage with friend&amp;rsquo;s keys&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Performance&lt;/strong&gt;: VM OS runs from fast local storage, while backups use dedicated iSCSI storage&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Flexibility&lt;/strong&gt;: Easy to manage and update the VM independently of backup storage&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Efficiency&lt;/strong&gt;: Minimizes data transfer over iSCSI for system operations&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;De-Clouded&lt;/strong&gt;: Your data stays between you and your friend, no cloud services involved&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;&lt;p&gt;Regarding increasing storage capacity:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;While TrueNAS allows increasing the size of zvols on the fly, this approach has limitations for our VM setup.&lt;/li&gt;&#10;&lt;li&gt;A more robust scaling method is to add new iSCSI targets in Proxmox:&#10;&lt;ol&gt;&#10;&lt;li&gt;Create additional zvols on your main TrueNAS&lt;/li&gt;&#10;&lt;li&gt;Set up new iSCSI targets for these zvols&lt;/li&gt;&#10;&lt;li&gt;Add these new targets as virtual disks to your TrueNAS VM in Proxmox&lt;/li&gt;&#10;&lt;li&gt;Expand the ZFS pool in the VM by adding these new virtual disks&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;This method allows for more flexible growth of your backup storage, as you can add disks of various sizes and expand your pool incrementally.&lt;/li&gt;&#10;&lt;li&gt;It also maintains better performance, as multiple iSCSI targets can potentially use different network paths or interfaces.&lt;/li&gt;&#10;&lt;/ul&gt;&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="step-by-step-setup"&gt;Step-by-Step Setup &lt;a class="anchor" href="#step-by-step-setup" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;h3 id="on-your-main-truenas"&gt;On your main TrueNAS &lt;a class="anchor" href="#on-your-main-truenas" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Create a new zvol for backup storage&#10;&lt;ul&gt;&#10;&lt;li&gt;Navigate to Storage &amp;gt; Pools &amp;gt; [Your Pool] &amp;gt; zvols&lt;/li&gt;&#10;&lt;li&gt;Click &amp;ldquo;ADD zvol&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;Name it (e.g., &amp;ldquo;friend_backup&amp;rdquo;)&lt;/li&gt;&#10;&lt;li&gt;Set an appropriate size&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Set up an iSCSI target&#10;&lt;ul&gt;&#10;&lt;li&gt;Go to Sharing &amp;gt; Block Shares (iSCSI)&lt;/li&gt;&#10;&lt;li&gt;Click &amp;ldquo;Add&amp;rdquo; under Targets&lt;/li&gt;&#10;&lt;li&gt;Give it a name and create&lt;/li&gt;&#10;&lt;li&gt;Under Extents, click &amp;ldquo;Add&amp;rdquo;, select the zvol you created&lt;/li&gt;&#10;&lt;li&gt;Under Associated Targets, add your new target and extent&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="on-proxmox"&gt;On Proxmox &lt;a class="anchor" href="#on-proxmox" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Mount the iSCSI in Proxmox&#10;&lt;ul&gt;&#10;&lt;li&gt;Go to Datacenter &amp;gt; Storage &amp;gt; Add &amp;gt; iSCSI&lt;/li&gt;&#10;&lt;li&gt;Enter your TrueNAS IP and the target name&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Create a TrueNAS VM&#10;&lt;ul&gt;&#10;&lt;li&gt;Download TrueNAS ISO to &lt;code&gt;/var/lib/vz/template/iso&lt;/code&gt;&lt;/li&gt;&#10;&lt;li&gt;Click &amp;ldquo;Create VM&amp;rdquo;&lt;/li&gt;&#10;&lt;li&gt;Select the TrueNAS ISO&lt;/li&gt;&#10;&lt;li&gt;In the &amp;ldquo;Hard Disk&amp;rdquo; step, add two SCSI disks:&#10;&lt;ul&gt;&#10;&lt;li&gt;One on local storage (for OS)&lt;/li&gt;&#10;&lt;li&gt;One on the iSCSI storage (for backups)&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Install TrueNAS&#10;&lt;ul&gt;&#10;&lt;li&gt;Start the VM and open console&lt;/li&gt;&#10;&lt;li&gt;Install TrueNAS on the local disk&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;Configure TrueNAS VM&#10;&lt;ul&gt;&#10;&lt;li&gt;Access the TrueNAS web interface&lt;/li&gt;&#10;&lt;li&gt;Create a ZFS pool on the iSCSI disk&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="set-up-secure-access"&gt;Set up secure access &lt;a class="anchor" href="#set-up-secure-access" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Install and configure Tailscale (or preferred VPN)&#10;&lt;ul&gt;&#10;&lt;li&gt;On both your system and the TrueNAS VM&lt;/li&gt;&#10;&lt;li&gt;Use a self-hosted Headscale server for more control&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="for-your-friend"&gt;For your friend &lt;a class="anchor" href="#for-your-friend" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Provide VPN access to the TrueNAS VM&lt;/li&gt;&#10;&lt;li&gt;They can now set up replication tasks to the VM&amp;rsquo;s iSCSI storage using the TrueNAS web interface and their own encryption keys&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h3 id="repeat-the-process"&gt;Repeat the process &lt;a class="anchor" href="#repeat-the-process" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Follow the same steps on your friend&amp;rsquo;s system, reversing roles&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="considerations"&gt;Considerations &lt;a class="anchor" href="#considerations" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;Network&lt;/strong&gt;: Ensure your internet connection can handle the data transfer&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Initial Seeding&lt;/strong&gt;: For large datasets, consider initial seeding in person&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Encryption&lt;/strong&gt;: Use encryption for the replicated datasets and VPN access for added security&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Testing&lt;/strong&gt;: Thoroughly test the setup before relying on it for critical backups&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Trust&lt;/strong&gt;: Choose your backup partner wisely - the other person will have access to the TrueNAS VM but not its data (if encrypted)&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;VM Maintenance&lt;/strong&gt;: Regularly update and maintain the VM&amp;rsquo;s operating system&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="conclusion"&gt;Conclusion &lt;a class="anchor" href="#conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;This friend-to-friend setup offers TrueNAS users an effective approach to remote backups. By creating mutual TrueNAS VMs, we&amp;rsquo;ve established a secure, decentralized backup solution with several advantages:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Privacy and Security&lt;/strong&gt;: Each friend has their own remote TrueNAS VM, with data remaining private when properly encrypted. Importantly, while you grant your friend access to your network, it&amp;rsquo;s limited to only the backup VM. You can firewall off the rest of your network, maintaining overall system security.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Full ZFS Feature Set&lt;/strong&gt;: This setup allows us to use ZFS features like snapshot-based backups, incremental replication, and data integrity checks.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Flexible Backup Strategies&lt;/strong&gt;: We can back up entire filesystems and maintain multiple snapshot versions.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;De-clouded Solution&lt;/strong&gt;: By partnering with a trusted friend, we&amp;rsquo;ve created a backup system that keeps our data out of corporate clouds, reducing costs and increasing control.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Scalability&lt;/strong&gt;: As data needs grow, we can add additional iSCSI targets in Proxmox and incorporate these new virtual disks into our ZFS pool.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;strong&gt;Network Isolation&lt;/strong&gt;: Despite allowing access for backups, your main network remains protected. You control exactly what your backup partner can access, limiting potential security risks.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This solution represents a step towards data sovereignty and community-based storage. It&amp;rsquo;s secure, efficient, and independent of large tech companies, while still maintaining tight control over your network access.&lt;/p&gt;&#10;&lt;p&gt;Remember to regularly test your backup and restore processes, and periodically review your firewall rules. With this setup, you have a comprehensive, friend-to-friend backup solution that doesn&amp;rsquo;t compromise your overall network security.&lt;/p&gt;&#10;&lt;p&gt;Happy backing up!&lt;/p&gt;&#10;</description></item><item><title>My homelab: from a single Raspberry Pi to a Proxmox cluster and a dedicated NAS 🔧</title><link>https://www.nijho.lt/post/homelab/</link><pubDate>Sat, 06 Jul 2024 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/homelab/</guid><description>&lt;p&gt;In 2020, I began my homelab journey (&lt;em&gt;even though I never heard of the term &amp;ldquo;homelab&amp;rdquo; at that point&lt;/em&gt;) with a simple yet powerful setup: Home Assistant running on Proxmox on a NUC8i3BEH.&#10;My Home Assistant instance, with over 100 automations and about 20 addons (docker containers), had outgrown the capabilities of my Raspberry Pi 4, leading me to upgrade to the NUC8i3BEH.&#10;You can check out my &lt;a href="https://github.com/basnijholt/home-assistant-config/" target="_blank" rel="noopener"&gt;Home Assistant configuration&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;This system was more than sufficient for running Home Assistant—arguably overkill.&#10;However, because I passionately develop addons and custom components, I needed the ability to quickly restart and reload everything while debugging.&#10;For a long time, I ran Proxmox, mainly because the Home Assistant community recommended it, but I only used it to host one extra Ubuntu VM and Home Assistant OS.&lt;/p&gt;&#10;&lt;p&gt;In 2022, I stumbled upon the &lt;a href="https://github.com/tteck/Proxmox" target="_blank" rel="noopener"&gt;Proxmox VE Helper-Scripts&lt;/a&gt; by tteck, which got me interested in the whole homelabber/self-hosting community.&#10;These scripts opened a new world of possibilities.&#10;With them, I expanded my Proxmox environment to run 25 different VMs and &lt;a href="https://linuxcontainers.org/lxc/introduction/" target="_blank" rel="noopener"&gt;LXC containers&lt;/a&gt;, each performing a variety of tasks, from DNS servers and reverse proxies to local dashboards and backup software.&lt;/p&gt;&#10;&lt;p&gt;Initially, I used an external 2 TB drive for storage, but it quickly became insufficient as my data needs grew.&#10;After some research, I found the &lt;a href="https://support.hp.com/id-en/document/c06047207" target="_blank" rel="noopener"&gt;HP EliteDesk 800 G4 SFF&lt;/a&gt;, a renewed enterprise-grade desktop with slots for two 3.5-inch drives.&#10;At approximately $160 on Amazon, it offered excellent specs for a budget-friendly price.&#10;I decided to create a TrueNAS VM on this machine using Proxmox and passed through the two 16TB renewed enterprise-level HDDs (via the PCIe SATA controller), which I had purchased from serverpartdeals.com.&#10;I chose these drives based on their reliability as reported in the &lt;a href="https://www.backblaze.com/blog/backblaze-drive-stats-for-2023/" target="_blank" rel="noopener"&gt;BackBlaze drive stats&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;When I got the HP, I created a Proxmox cluster and was very excited about how easy it was to migrate containers and VMs from one machine to the other.&#10;However, I soon encountered a significant drawback: enterprise drives are notably loud.&#10;Since I had my Proxmox &amp;ldquo;cluster&amp;rdquo; (just the two machines) running behind the TV, the loudness was noticeable and disruptive.&#10;This noise was just the beginning of my troubles.&#10;The NFS server on the TrueNAS VM often crashed, causing the entire Proxmox system to lock up.&#10;Initially, I mounted the NFS drives directly on the Proxmox host and used bind-mounts to pass through the drives.&#10;Due to the locking behavior of NFS, any problem would cause the entire system to lock up.&#10;To prevent this, I started to use &lt;a href="https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/storage_administration_guide/nfs-autofs" target="_blank" rel="noopener"&gt;autofs&lt;/a&gt; to mount the drives in the LXC containers and VMs instead.&#10;This worked fine until Proxmox started its periodic backups.&#10;Any issue with the NFS during backup caused the whole process to hang, locking up the VMs and LXC containers.&#10;This could be partially avoided by using the &amp;ldquo;stop&amp;rdquo; backup mode, but it still resulted in almost daily debugging sessions where I had to restart Proxmox-related services.&lt;/p&gt;&#10;&lt;p&gt;After running all services as LXC containers, I realized that updating them and keeping up with all security updates was labor-intensive.&#10;So, I started to look into migrating everything to Docker Compose.&#10;This transition turned out great because I could manage my config files in a git repo and keep the relevant data separate, streamlining updates and maintenance.&lt;/p&gt;&#10;&lt;p&gt;To resolve these issues and because I was having a lot of fun, I decided to build a dedicated NAS running TrueNAS Scale, not that I &lt;em&gt;really&lt;/em&gt; needed one, but mostly because I could.&#10;This new setup included high-performance components, ensuring both stability and quiet operation.&#10;I used &amp;ldquo;Manufacturer Recertified&amp;rdquo; &lt;a href="https://www.westerndigital.com/products/internal-drives/data-center-drives/ultrastar-dc-hc550-hdd?sku=0F38356" target="_blank" rel="noopener"&gt;Western Digital Ultrastar DC HC550 HDDs&lt;/a&gt;, known for their reliability and performance.&#10;I have 6 x 16TB = 96TB now with the option to add 2 more 3.5&amp;quot; drives, 2 nvme M.2 drives, and 1 SATA 2.5&amp;quot; SSD.&#10;Now, I run all services that previously relied on NFS locally on TrueNAS via a Debian &lt;a href="https://wiki.debian.org/nspawn" target="_blank" rel="noopener"&gt;systemd-nspawn container&lt;/a&gt; managed with a new script called &lt;a href="https://github.com/Jip-Hop/jailmaker" target="_blank" rel="noopener"&gt;Jailmaker&lt;/a&gt;, which leverages the systemd-nspawn program in TrueNAS Scale (not to be confused with FreeBSD jails).&#10;Inside this systemd-nspawn container, I run Debian with Docker.&#10;For managing Docker Compose files, I use &lt;a href="https://github.com/louislam/dockge" target="_blank" rel="noopener"&gt;Dockge&lt;/a&gt;, which provides a nice web UI for easy management.&lt;/p&gt;&#10;&lt;p&gt;Along the way, I got familiar with ZFS and grew to love it for its amazing snapshotting and data integrity features.&#10;ZFS has been a game-changer, providing robust data protection and ease of management.&#10;Initially, &lt;a href="https://jrs-s.net/2015/02/06/zfs-you-should-use-mirror-vdevs-not-raidz/" target="_blank" rel="noopener"&gt;I used mirrored vdevs&lt;/a&gt;, but I recently switched to RAIDZ2 for the added storage capacity and &lt;a href="https://github.com/openzfs/zfs/pull/15022#issuecomment-1802428899" target="_blank" rel="noopener"&gt;the promise of OpenZFS 2.3 supporting expansion of RAIDZ vdevs&lt;/a&gt;.&#10;I also use ZFS for my Proxmox VMs and LXC containers, whose backups I store on the NAS via rsync in a cronjob to another jail running plain Debian (no more NFS on the Proxmox host for me&amp;hellip;)&lt;/p&gt;&#10;&lt;p&gt;This journey from a simple NUC running Home Assistant to a Proxmox cluster and dedicated NAS has been very time-consuming but a lot of fun.&#10;The lessons learned and the improvements in stability and performance have made the effort worthwhile.&#10;If you&amp;rsquo;re considering building your own homelab, investing in reliable hardware and being prepared for a bit of trial and error can make all the difference.&lt;/p&gt;&#10;&lt;h2 id="lessons-learned"&gt;Lessons learned &lt;a class="anchor" href="#lessons-learned" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Run your services in Docker containers, not LXC containers, for easier management and updates.&lt;/li&gt;&#10;&lt;li&gt;Do &lt;strong&gt;not&lt;/strong&gt; have virtualized NAS (TrueNAS VM) on Proxmox, it&amp;rsquo;s a bad idea if you are also sharing the drives with Proxmox via NFS. There are many folks on the internet who run their NAS in a VM on Proxmox, seemingly without issues, but I was not one of them.&lt;/li&gt;&#10;&lt;li&gt;Do not encrypt the root ZFS dataset! Encrypt its children instead.&lt;/li&gt;&#10;&lt;li&gt;Use passphrase encryption instead of a generated key. It allows you to use the UI and rotating keys.&lt;/li&gt;&#10;&lt;li&gt;Do &lt;strong&gt;not&lt;/strong&gt; remove the physical drive that is passed through in a Proxmox VM, because Proxmox will &lt;em&gt;not&lt;/em&gt; boot properly afterwards.&lt;/li&gt;&#10;&lt;li&gt;Do &lt;strong&gt;not&lt;/strong&gt; use random 100 character passwords for your Proxmox, you have only 60 seconds to enter it during boot.&lt;/li&gt;&#10;&lt;li&gt;When making Proxmox backups, send them to a different physical machine, not only the same machine that is being backed up.&lt;/li&gt;&#10;&lt;li&gt;When building a NAS or home server, consider noise levels, especially if the equipment will be in a living area. Enterprise-grade drives can be surprisingly loud.&lt;/li&gt;&#10;&lt;li&gt;When using Intel I226-V 2.5GbE controllers, be prepared for potential issues.&lt;/li&gt;&#10;&lt;li&gt;When planning your NAS storage size needs, remember to account for the extra space needed for redundancy (e.g., in RAIDZ2). Additionally, keep in mind that ZFS performs optimally when drives aren&amp;rsquo;t filled to capacity. It&amp;rsquo;s wise to plan for more storage than you think you&amp;rsquo;ll immediately need.&lt;/li&gt;&#10;&lt;li&gt;Buy as many used enterprise-grade hardware components as you can, they are often cheaper and more reliable than consumer-grade components.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h2 id="components"&gt;Components &lt;a class="anchor" href="#components" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For completeness, here are the components for each machine in my homelab:&lt;/p&gt;&#10;&lt;h3 id="nuc-components"&gt;NUC Components &lt;a class="anchor" href="#nuc-components" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Name&lt;/th&gt;&#10;&lt;th&gt;Full Name&lt;/th&gt;&#10;&lt;th&gt;Server&lt;/th&gt;&#10;&lt;th&gt;Price&lt;/th&gt;&#10;&lt;th&gt;Quantity&lt;/th&gt;&#10;&lt;th&gt;Cost&lt;/th&gt;&#10;&lt;th&gt;Date&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;NUC8i3BEH&lt;/td&gt;&#10;&lt;td&gt;Intel NUC Kit NUC8i3BEH&lt;/td&gt;&#10;&lt;td&gt;NUC&lt;/td&gt;&#10;&lt;td&gt;278.3&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;278.3&lt;/td&gt;&#10;&lt;td&gt;2020-02-22&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;500GB M2 SSD&lt;/td&gt;&#10;&lt;td&gt;Samsung 970 EVO M.2 500GB&lt;/td&gt;&#10;&lt;td&gt;NUC&lt;/td&gt;&#10;&lt;td&gt;94.99&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;94.99&lt;/td&gt;&#10;&lt;td&gt;2020-02-21&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;32 GB RAM&lt;/td&gt;&#10;&lt;td&gt;TEAMGROUP 32GB DDR4 3200MHz&lt;/td&gt;&#10;&lt;td&gt;NUC&lt;/td&gt;&#10;&lt;td&gt;58.99&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;58.99&lt;/td&gt;&#10;&lt;td&gt;2024-05-01&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;4TB SSD&lt;/td&gt;&#10;&lt;td&gt;Crucial P3 Plus 4TB NVMe&lt;/td&gt;&#10;&lt;td&gt;NUC&lt;/td&gt;&#10;&lt;td&gt;226.99&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;226.99&lt;/td&gt;&#10;&lt;td&gt;2024-04-27&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;!-- | 16 GB DDR4 | Crucial 8GB DDR4 2400 MT/s | NUC | 25.52 | 2 | 51.04 | 2020-02-21 | --&gt;&#10;&lt;h3 id="hp-components"&gt;HP Components &lt;a class="anchor" href="#hp-components" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Name&lt;/th&gt;&#10;&lt;th&gt;Full Name&lt;/th&gt;&#10;&lt;th&gt;Server&lt;/th&gt;&#10;&lt;th&gt;Price&lt;/th&gt;&#10;&lt;th&gt;Quantity&lt;/th&gt;&#10;&lt;th&gt;Cost&lt;/th&gt;&#10;&lt;th&gt;Date&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;64 GB RAM&lt;/td&gt;&#10;&lt;td&gt;TEAMGROUP 32GB DDR4 3200MHz&lt;/td&gt;&#10;&lt;td&gt;HP&lt;/td&gt;&#10;&lt;td&gt;57.99&lt;/td&gt;&#10;&lt;td&gt;2&lt;/td&gt;&#10;&lt;td&gt;115.98&lt;/td&gt;&#10;&lt;td&gt;2024-05-02&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;HP EliteDesk 800 G4 SFF&lt;/td&gt;&#10;&lt;td&gt;HP EliteDesk 800 G4 SFF&lt;/td&gt;&#10;&lt;td&gt;HP&lt;/td&gt;&#10;&lt;td&gt;164&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;164&lt;/td&gt;&#10;&lt;td&gt;2024-04-27&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;!-- | SSD enclosure | UGREEN SSD Enclosure | HP | 16.98 | 1 | 16.98 | 2024-04-27 | --&gt;&#10;&lt;p&gt;Notes on the HP components:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Initially, I planned to use this machine as a NAS because it has two 3.5&amp;quot; drive bays, 2 M.2 slots, and the disc drive bay can be converted to a 2.5&amp;quot; drive bay. However, the 2 x 16TB drives I bought quickly filled up because I used a mirrored vdev, so I decided to build a dedicated NAS instead.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h3 id="nas-components"&gt;NAS Components &lt;a class="anchor" href="#nas-components" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h3&gt;&#10;&lt;div class="table-wrap"&gt;&#10;&lt;table&gt;&#10;&lt;thead&gt;&#10;&lt;tr&gt;&#10;&lt;th&gt;Name&lt;/th&gt;&#10;&lt;th&gt;Full Name&lt;/th&gt;&#10;&lt;th&gt;Server&lt;/th&gt;&#10;&lt;th&gt;Price&lt;/th&gt;&#10;&lt;th&gt;Quantity&lt;/th&gt;&#10;&lt;th&gt;Cost&lt;/th&gt;&#10;&lt;th&gt;Date&lt;/th&gt;&#10;&lt;/tr&gt;&#10;&lt;/thead&gt;&#10;&lt;tbody&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;16 TB HDD&lt;/td&gt;&#10;&lt;td&gt;Western Digital Ultrastar DC HC550 16TB&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;159.99&lt;/td&gt;&#10;&lt;td&gt;2&lt;/td&gt;&#10;&lt;td&gt;319.98&lt;/td&gt;&#10;&lt;td&gt;2024-05-01&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;16 TB HDD&lt;/td&gt;&#10;&lt;td&gt;Western Digital Ultrastar DC HC550 16TB&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;187.5&lt;/td&gt;&#10;&lt;td&gt;4&lt;/td&gt;&#10;&lt;td&gt;750&lt;/td&gt;&#10;&lt;td&gt;2024-06-21&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Motherboard&lt;/td&gt;&#10;&lt;td&gt;Q670 8-bay NAS motherboard&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;203.21&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;203.21&lt;/td&gt;&#10;&lt;td&gt;2024-06-22&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;CPU i5 13500T&lt;/td&gt;&#10;&lt;td&gt;Intel Core i5-13500T&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;180.88&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;180.88&lt;/td&gt;&#10;&lt;td&gt;2024-06-22&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;PSU SFX&lt;/td&gt;&#10;&lt;td&gt;FSP Dagger Pro 650W&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;87.13&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;87.13&lt;/td&gt;&#10;&lt;td&gt;2024-06-21&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;Jonsbo N3 case&lt;/td&gt;&#10;&lt;td&gt;JONSBO N3 Mini-ITX NAS Case&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;187.51&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;187.51&lt;/td&gt;&#10;&lt;td&gt;2024-06-16&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;CPU cooler&lt;/td&gt;&#10;&lt;td&gt;Thermalright AXP90 X36 CPU cooler&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;21.83&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;21.83&lt;/td&gt;&#10;&lt;td&gt;2024-06-25&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;tr&gt;&#10;&lt;td&gt;64 GB DDR5 RAM&lt;/td&gt;&#10;&lt;td&gt;CORSAIR VENGEANCE 64GB DDR5&lt;/td&gt;&#10;&lt;td&gt;NAS&lt;/td&gt;&#10;&lt;td&gt;162.13&lt;/td&gt;&#10;&lt;td&gt;1&lt;/td&gt;&#10;&lt;td&gt;162.13&lt;/td&gt;&#10;&lt;td&gt;2024-06-29&lt;/td&gt;&#10;&lt;/tr&gt;&#10;&lt;/tbody&gt;&#10;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;Notes on the NAS components:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;The 13500T is a 35W TDP CPU I bought on eBay, which will help keep the system cool and quiet.&lt;/li&gt;&#10;&lt;li&gt;I bought the motherboard from AliExpress because it seems to be the only mini-ITX motherboard that supports 8 SATA drives, and also comes with 2x2.5GbE ports, 3xM.2 slots, and a full sized PCIe slot.&lt;/li&gt;&#10;&lt;li&gt;The motherboard uses Intel I225-V 2.5GbE controllers, which are notoriously bad, initially &lt;code&gt;iperf3&lt;/code&gt; maxed out at 100Mbps. The internet is full with people complaining about these controllers auto-negotiating to 100Mbps, however, for me it showed 1Gbps. After trying all suggestions I could find (there are few), as a last resort I connecting the NAS directly to my ASUS XT8 router instead of the NETGEAR GS305 switch, and now I got 1Gbps speeds. So I bought a new managed TL-SG108E switch, which now also gives me 1Gbps speeds. I&amp;rsquo;m not sure what the issue was, but I&amp;rsquo;m happy it&amp;rsquo;s resolved.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;</description></item><item><title>My favorite tools that keep my Python projects sane 🧰</title><link>https://www.nijho.lt/post/best-python-dev-tooling/</link><pubDate>Sat, 22 Apr 2023 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/best-python-dev-tooling/</guid><description>&lt;h2 id="-1-introduction"&gt;🌟 1. Introduction &lt;a class="anchor" href="#-1-introduction" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As a passionate Python developer, I am always on the hunt for the best tools to streamline my development process and enhance the quality of my projects. Over time, I have discovered a set of tools that have become indispensable in my workflow, making my coding experience more efficient and enjoyable. Using the right developer tools for Python projects is crucial for maximizing productivity, ensuring code consistency, and maintaining high-quality code.&lt;/p&gt;&#10;&lt;p&gt;In this blog post, I will share these essential tools that I now use for every single new project. We will explore the benefits of each tool and discuss how they can help you supercharge your Python development. The tools covered in this post include &lt;a href="https://pre-commit.com/" target="_blank" rel="noopener"&gt;pre-commit&lt;/a&gt;, &lt;a href="https://black.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Black&lt;/a&gt;, &lt;a href="https://beta.ruff.rs/docs/rules/" target="_blank" rel="noopener"&gt;Ruff&lt;/a&gt;, &lt;a href="https://mypy.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Mypy&lt;/a&gt;, &lt;a href="https://versioningit.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Versioningit&lt;/a&gt;, &lt;a href="https://www.python.org/dev/peps/pep-0621/" target="_blank" rel="noopener"&gt;Pyproject.toml with PEP 621&lt;/a&gt;, &lt;a href="https://nox.thea.codes/en/stable/" target="_blank" rel="noopener"&gt;Nox&lt;/a&gt;, &lt;a href="https://docs.pytest.org/en/7.3.x/" target="_blank" rel="noopener"&gt;pytest&lt;/a&gt;, &lt;a href="https://docs.github.com/en/actions/learn-github-actions" target="_blank" rel="noopener"&gt;GitHub Actions CI matrix&lt;/a&gt;, and &lt;a href="https://readthedocs.org/" target="_blank" rel="noopener"&gt;Read the Docs&lt;/a&gt;, &lt;a href="https://www.sphinx-doc.org/" target="_blank" rel="noopener"&gt;Sphinx&lt;/a&gt;, &lt;a href="https://myst-nb.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;MyST-NB&lt;/a&gt;, and &lt;a href="https://jupytext.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Jupytext notebooks&lt;/a&gt; for documentation. Let&amp;rsquo;s dive in and learn how to enhance your Python projects with these powerful tools!&lt;/p&gt;&#10;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#-1-introduction"&gt;🌟 1. Introduction&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-2-pre-commit"&gt;🛠️ 2. Pre-commit&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-3-black-auto-formatting-for-python"&gt;🎨 3. Black: auto-formatting for Python&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-4-ruff-the-fastest-python-linter-and-auto-formatter"&gt;🚀 4. Ruff: the fastest Python linter and auto-formatter&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-5-mypy-static-type-checking-for-python-find-bugs-before-they-happen"&gt;🔍 5. Mypy: static type checking for Python (find bugs before they happen)&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-6-nox-and-pytest-for-testing-a-powerful-combination"&gt;🧪 6. Nox and pytest for testing: a powerful combination&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-7-versioningit-version-management-with-git-tags"&gt;🏷️ 7. Versioningit: version management with Git tags&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-8-pyprojecttoml-and-pep-621-configuration-consolidation"&gt;📝 8. Pyproject.toml and PEP 621: Configuration Consolidation&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-9-github-actions-ci-matrix-testing-on-multiple-platforms-and-auto-publishing-to-pypi"&gt;🌐 9. GitHub Actions CI Matrix: Testing on Multiple Platforms and Auto Publishing to PyPI&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-10-read-the-docs-sphinx-myst-nb-and-jupytext-notebooks-for-documentation"&gt;📚 10. Read the Docs, Sphinx, MyST-NB, and Jupytext notebooks for documentation&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-11-conclusion"&gt;🎉 11. Conclusion&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;This post is based the way I develop Python projects. For full examples see &lt;a href="https://github.com/basnijholt/adaptive-scheduler/" target="_blank" rel="noopener"&gt;Adaptive Scheduler&lt;/a&gt; (full project), &lt;a href="https://github.com/basnijholt/markdown-code-runner" target="_blank" rel="noopener"&gt;&lt;code&gt;markdown-code-runner&lt;/code&gt;&lt;/a&gt; (for a single module package), and &lt;a href="https://github.com/python-adaptive/adaptive/" target="_blank" rel="noopener"&gt;Adaptive&lt;/a&gt; (for cool documentation and nox).&#10;Over time I might change my mind about some of the tools, but I will try to keep this post up-to-date.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="-2-pre-commit"&gt;🛠️ 2. Pre-commit &lt;a class="anchor" href="#-2-pre-commit" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;One of the most common challenges developers face when working on a project, whether alone or in a team, is maintaining code quality and consistency. As projects grow, it becomes increasingly difficult to enforce coding standards and catch issues before they make their way into the codebase. This is where pre-commit comes in.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://pre-commit.com/" target="_blank" rel="noopener"&gt;Pre-commit&lt;/a&gt; is a powerful tool that helps you manage and maintain code quality by automating checks before commits. It achieves this by setting up a series of hooks that run before each commit, ensuring that only code that meets your predefined standards is committed to the repository. By catching issues early, pre-commit helps you keep your code clean and consistent, making it easier to review and maintain.&lt;/p&gt;&#10;&lt;p&gt;One of the reasons pre-commit has gained widespread adoption is its flexibility and extensibility. You can choose from a vast range of built-in hooks, such as code formatters, linters, and security checkers, or even create your own custom hooks. This allows you to tailor pre-commit to the specific needs of your project, ensuring that it enforces the exact coding standards you require.&lt;/p&gt;&#10;&lt;p&gt;Using pre-commit is beneficial for both individual developers and teams. For solo developers, it helps maintain discipline and enforces coding standards, making it easier to onboard collaborators in the future. For teams, it streamlines the review process by catching issues before they are submitted for review, reducing the time spent on addressing code inconsistencies and style violations.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s take a look at an example. Suppose your project follows the PEP 8 coding standard, and you want to ensure that all code committed to the repository adheres to these guidelines. You can configure pre-commit to run a PEP 8 linter, such as Flake8, before each commit. This way, any code that does not meet the PEP 8 standard will be flagged, and the commit will be blocked until the issues are resolved.&lt;/p&gt;&#10;&lt;p&gt;In summary, pre-commit is an invaluable tool for maintaining code quality and consistency in your Python projects. By automating checks before commits, it ensures that your codebase remains clean and adheres to your chosen standards, making your development process more efficient and enjoyable.&lt;/p&gt;&#10;&lt;p&gt;Adding pre-commit to your Python project is simple and straightforward. To get started, you&amp;rsquo;ll first need to install the pre-commit package using pip:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install pre-commit&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, create a configuration file named &lt;code&gt;.pre-commit-config.yaml&lt;/code&gt; in your project&amp;rsquo;s root directory. This file will define the hooks you want to run before each commit. For example, to use Black for code formatting and Flake8 for linting, your configuration file might look like this:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;repos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;https://github.com/psf/black&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;rev&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;stable&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;black&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;https://github.com/pycqa/flake8&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;rev&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;master&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;hooks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;flake8&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Once you have set up the configuration file, run the following command to install the pre-commit hooks:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pre-commit install&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, every time you attempt to make a commit, pre-commit will run the specified hooks. If any issues are found, the commit will be blocked, and you&amp;rsquo;ll be prompted to fix the problems before trying again. To run pre-commit manually on all files in your repository, use the following command:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pre-commit run --all-files&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;By incorporating pre-commit into your development process, you&amp;rsquo;ll be able to catch and fix issues before they make their way into your codebase, ensuring a consistent and high-quality Python project.&lt;/p&gt;&#10;&lt;h2 id="-3-black-auto-formatting-for-python"&gt;🎨 3. Black: auto-formatting for Python &lt;a class="anchor" href="#-3-black-auto-formatting-for-python" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As a developer who has always been particular about coding style, I&amp;rsquo;ve had my fair share of discussions on the proper way to indent multiline statements and other formatting nuances. These conversations, although sometimes necessary, can take up valuable time that could be better spent on actual development. That&amp;rsquo;s where Black, the uncompromising code formatter, comes in and saves the day.&lt;/p&gt;&#10;&lt;p&gt;Adopting &lt;a href="https://black.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Black&lt;/a&gt; has made a significant impact on my development workflow. No more unnecessary discussions about formatting preferences; everyone on the team simply follows the rules set forth by Black. This consistency across the codebase not only makes the code more readable but also reduces the time spent on formatting debates.&lt;/p&gt;&#10;&lt;p&gt;One of the best aspects of Black is that you don&amp;rsquo;t need to worry about writing perfectly formatted code initially. You can write your code as quickly as you want, even if it&amp;rsquo;s poorly formatted, and then simply run Black to transform it into a beautifully formatted masterpiece. This can be a real time-saver, especially when working on large projects with many contributors.&lt;/p&gt;&#10;&lt;p&gt;To install Black, run the following command:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install black&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You can then format your code by running Black in the terminal:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;black your_file.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Alternatively, you can use the VS Code command palette to run Black on the currently open file. However, the most efficient way to use Black is in combination with pre-commit, as mentioned in the previous section. This way, your code is automatically formatted every time you commit, ensuring a consistent codebase without any extra effort.&lt;/p&gt;&#10;&lt;p&gt;In summary, Black is an invaluable tool for enforcing consistent code formatting throughout your Python projects. By adopting it and integrating it with pre-commit, you can save time and focus on what truly matters: writing great code.&lt;/p&gt;&#10;&lt;h2 id="-4-ruff-the-fastest-python-linter-and-auto-formatter"&gt;🚀 4. Ruff: the fastest Python linter and auto-formatter &lt;a class="anchor" href="#-4-ruff-the-fastest-python-linter-and-auto-formatter" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In the past, I&amp;rsquo;ve used several tools to maintain code quality, such as isort, pyupgrade, flake8, and pydocstyle. However, I&amp;rsquo;ve recently discovered a powerful new tool called &lt;a href="https://beta.ruff.rs/docs/rules/" target="_blank" rel="noopener"&gt;Ruff&lt;/a&gt;), an extremely fast Python linter written in Rust. Ruff is not only capable of replacing all these tools but also executes much faster, which significantly improves the development workflow.&lt;/p&gt;&#10;&lt;p&gt;Ruff offers an impressive range of features and performance enhancements. Some of its standout features include:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;10-100x faster than existing linters&lt;/li&gt;&#10;&lt;li&gt;Over 500 built-in rules&lt;/li&gt;&#10;&lt;li&gt;Autofix support for automatic error correction&lt;/li&gt;&#10;&lt;li&gt;Built-in caching to avoid re-analyzing unchanged files&lt;/li&gt;&#10;&lt;li&gt;First-party editor integrations for VS Code and more&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Moreover, Ruff has gained widespread adoption in the Python community and is used in major open-source projects like Apache Airflow, FastAPI, Hugging Face, Pandas, and SciPy. The tool is backed by Astral, which provides active development and support.&lt;/p&gt;&#10;&lt;p&gt;One of the best aspects of Ruff is the native VS Code extension, which continuously scans your code and can fix problems as you write. This seamless integration makes it an indispensable part of any Python development workflow.&lt;/p&gt;&#10;&lt;p&gt;To install Ruff, simply run the following command:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install ruff&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To use Ruff in your project, run the following command in the terminal:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;ruff your_file.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For the best experience, I highly recommend using Ruff in conjunction with pre-commit, as mentioned earlier. This ensures that your code is always linted and formatted before committing, maintaining a consistent and high-quality codebase.&lt;/p&gt;&#10;&lt;p&gt;In conclusion, Ruff is an incredibly fast and powerful Python linter that streamlines the development process by consolidating multiple tools into a single, efficient package. By adopting Ruff and integrating it with pre-commit, you can enjoy a more productive and enjoyable Python development experience.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Pro tip: Go extreme, and use &lt;code&gt;--select ALL&lt;/code&gt; to enable all (&amp;gt;500) rules. This will ensure that your code is always in top shape.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="-5-mypy-static-type-checking-for-python-find-bugs-before-they-happen"&gt;🔍 5. Mypy: static type checking for Python (find bugs before they happen) &lt;a class="anchor" href="#-5-mypy-static-type-checking-for-python-find-bugs-before-they-happen" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;As developers, we&amp;rsquo;re always looking for ways to improve the quality of our code and minimize the time spent on debugging. This is where &lt;a href="https://mypy.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Mypy&lt;/a&gt; comes in. Mypy is a powerful static type checker for Python, designed to catch potential runtime errors before they occur. By using Mypy, you can ensure that your code adheres to type hints and that it runs smoothly without unexpected issues.&lt;/p&gt;&#10;&lt;p&gt;Mypy offers several advantages to Python developers, including:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Early detection of potential type errors, preventing many common bugs&lt;/li&gt;&#10;&lt;li&gt;Improved code readability and self-documentation through type annotations&lt;/li&gt;&#10;&lt;li&gt;Easier refactoring and code maintenance, as type annotations provide clear contracts between functions and modules&lt;/li&gt;&#10;&lt;li&gt;Better collaboration and communication within teams, since type annotations make the code&amp;rsquo;s intent and expectations more explicit&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Adding Mypy to an existing project may initially seem time-consuming and frustrating, as it might flag numerous issues that require attention. However, once you&amp;rsquo;ve addressed these concerns and properly set up Mypy, the benefits far outweigh the initial effort. In fact, the time you invest in fixing type-related issues will quickly be recovered as Mypy helps you prevent bugs and reduce debugging time.&lt;/p&gt;&#10;&lt;p&gt;For a long time, I too ignored Mypy and only typed my code without actually checking it with the tool. But after truly embracing Mypy and integrating it into my development process, I can confidently say that I will never go back. The value it brings to the table in terms of code quality, readability, and reliability is simply too great to ignore.&lt;/p&gt;&#10;&lt;p&gt;By proactively identifying and resolving type-related issues, Mypy not only saves you precious debugging time but also enhances the overall quality of your codebase. As you continue to rely on Mypy, you&amp;rsquo;ll find that it becomes an indispensable part of your Python development toolkit, ensuring that your projects remain robust and maintainable.&lt;/p&gt;&#10;&lt;p&gt;To start using Mypy in your project, first install it with the following command:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install mypy&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, you can run Mypy on your Python files by executing the following command in your terminal:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;mypy your_file.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For even better integration, you can add Mypy as a pre-commit hook, ensuring that your code is always checked for type consistency before being committed. This further strengthens the code quality and helps prevent potential runtime errors.&lt;/p&gt;&#10;&lt;p&gt;In summary, incorporating Mypy into your Python development workflow adds an extra layer of safety and clarity, making it easier to write high-quality, reliable code. By combining Mypy with other tools like Ruff and pre-commit, you can create a robust development environment that promotes productivity and code quality.&lt;/p&gt;&#10;&lt;h2 id="-6-nox-and-pytest-for-testing-a-powerful-combination"&gt;🧪 6. Nox and pytest for testing: a powerful combination &lt;a class="anchor" href="#-6-nox-and-pytest-for-testing-a-powerful-combination" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When developing software, it&amp;rsquo;s essential to ensure that your code is reliable and functions as expected. The key to achieving this goal is writing thorough tests, which not only help you identify issues early on but also prevent regressions in the future. While it&amp;rsquo;s often tempting to dive headfirst into coding, taking a step back and first writing tests for your solution can lead to more efficient and effective development. Even if this approach doesn&amp;rsquo;t come naturally, it&amp;rsquo;s crucial to write tests for every problem you encounter to keep your codebase stable and reliable.&lt;/p&gt;&#10;&lt;p&gt;In the realm of Python testing, &lt;a href="https://nox.thea.codes/en/stable/" target="_blank" rel="noopener"&gt;Nox&lt;/a&gt; and &lt;a href="https://docs.pytest.org" target="_blank" rel="noopener"&gt;pytest&lt;/a&gt; stand out as powerful tools that can greatly enhance your testing process. Nox is a versatile automation tool that simplifies running tests in multiple virtual environments, while pytest is a popular and feature-rich testing framework for Python. Together, these tools provide a formidable testing environment that simplifies test management and execution.&lt;/p&gt;&#10;&lt;p&gt;In the past, you may have used &lt;a href="https://tox.wiki/en/latest/" target="_blank" rel="noopener"&gt;Tox&lt;/a&gt;, a tool that manages test environments with a text-based configuration file (e.g., in &lt;code&gt;setup.cfg&lt;/code&gt; or &lt;code&gt;pyproject.toml&lt;/code&gt;). While Tox has served developers well for many years, including myself, Nox offers a more flexible alternative. Instead of relying on a text-based configuration, Nox takes advantage of a Python configuration file, providing virtually limitless configurability. This added flexibility makes it easy to create complex test matrices with different versions and dependencies, and even accommodate special conditions using simple if statements. After happily using Tox for years, I discovered Nox and found that it elevated my testing workflow to a whole new level.&lt;/p&gt;&#10;&lt;p&gt;To get started with Nox and pytest, create a basic &lt;code&gt;nox.py&lt;/code&gt; file and a sample test file for pytest. Here&amp;rsquo;s an example &lt;code&gt;nox.py&lt;/code&gt; configuration:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;nox&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nd"&gt;@nox.session&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3.7&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;3.8&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;3.9&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;tests&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;-r&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;requirements.txt&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;install&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;-r&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;test-requirements.txt&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;pytest&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And an example test file for pytest:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pytest&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_addition&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_subtraction&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Beyond basic testing functionality, pytest boasts powerful features such as fixtures, mocking and patching, and parameterization. Pytest fixtures enable you to create reusable resources for your tests, while mocking and patching allow you to replace parts of your system with fake objects, isolating your tests from external dependencies. Parameterization, implemented using &lt;code&gt;pytest.mark.parametrize&lt;/code&gt;, enables running the same test with multiple sets of inputs and expected outputs.&lt;/p&gt;&#10;&lt;p&gt;In conclusion, leveraging Nox and pytest for testing offers numerous advantages for developers who strive to improve code reliability and automate their testing workflows. By harnessing Nox&amp;rsquo;s exceptional configurability and pytest&amp;rsquo;s extensive testing features, you&amp;rsquo;ll establish a robust testing environment that bolsters code quality and ensures optimal performance.&lt;/p&gt;&#10;&lt;h2 id="-7-versioningit-version-management-with-git-tags"&gt;🏷️ 7. Versioningit: version management with Git tags &lt;a class="anchor" href="#-7-versioningit-version-management-with-git-tags" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;blockquote&gt;&#10;&lt;p&gt;(Optional, only related when making a Python package)&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;For developers seeking an automated and customizable package versioning solution, &lt;a href="https://versioningit.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Versioningit&lt;/a&gt; offers a powerful yet flexible approach. It is a setuptools plugin that automatically determines your package&amp;rsquo;s version based on your version control repository&amp;rsquo;s tags. The real advantage of Versioningit lies in its ability to customize the version format and even override separate functions used for version extraction and calculation.&lt;/p&gt;&#10;&lt;p&gt;Versioningit makes your release workflow extremely simple, especially if you have set up an automated build and twine PyPI upload pipeline. To create a new release, you only need to tag a version, and then click on the &amp;ldquo;Release&amp;rdquo; button in GitHub.&lt;/p&gt;&#10;&lt;p&gt;One of the major advantages of Versioningit is its minimal boilerplate code compared to other tools like &lt;a href="https://github.com/python-versioneer/python-versioneer" target="_blank" rel="noopener"&gt;Versioneer&lt;/a&gt;. Additionally, the Python &lt;code&gt;__version__&lt;/code&gt; string works seamlessly with editable installs (&lt;code&gt;pip install -e .&lt;/code&gt;), unlike &lt;a href="https://github.com/pypa/setuptools_scm" target="_blank" rel="noopener"&gt;setuptools_scm&lt;/a&gt;, which is a common issue faced by developers.&lt;/p&gt;&#10;&lt;p&gt;Over the years, I have explored many options for package versioning, including &lt;a href="https://github.com/python-versioneer/python-versioneer" target="_blank" rel="noopener"&gt;Versioneer&lt;/a&gt;, &lt;a href="https://github.com/jbweston/miniver" target="_blank" rel="noopener"&gt;Miniver&lt;/a&gt;, &lt;a href="https://github.com/pypa/setuptools_scm" target="_blank" rel="noopener"&gt;setuptools_scm&lt;/a&gt;, &lt;a href="https://github.com/peritus/bumpversion" target="_blank" rel="noopener"&gt;bumpversion&lt;/a&gt; (or &lt;a href="https://github.com/c4urself/bump2version" target="_blank" rel="noopener"&gt;bump2version&lt;/a&gt;), and manually setting everything. Versioningit stands out due to its simplicity, customization options, and compatibility with various workflows.&lt;/p&gt;&#10;&lt;p&gt;Some key features of Versioningit include:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Support for Git, modern Git archives, and Mercurial&lt;/li&gt;&#10;&lt;li&gt;Customizable version formatting using template strings&lt;/li&gt;&#10;&lt;li&gt;Optional writing of the final version and other details to a file for loading at runtime&lt;/li&gt;&#10;&lt;li&gt;Custom setuptools commands for inserting the final version and other details into a source file at build time&lt;/li&gt;&#10;&lt;li&gt;Customizable functions for VCS querying, tag-to-version calculation, version bumping, version formatting, and writing the version to a file&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;To use Versioningit in your project, simply add it to your project&amp;rsquo;s &lt;code&gt;pyproject.toml&lt;/code&gt; file in the &lt;code&gt;build-system.requires&lt;/code&gt; key. Then, create a &lt;code&gt;[tool.versioningit]&lt;/code&gt; table in your &lt;code&gt;pyproject.toml&lt;/code&gt; file. You can get up and running with just the minimal configuration - an empty table.&lt;/p&gt;&#10;&lt;p&gt;Once you have a &lt;code&gt;[tool.versioningit]&lt;/code&gt; table in your &lt;code&gt;pyproject.toml&lt;/code&gt; and your repository has at least one tag, building your project with &lt;code&gt;setuptools&lt;/code&gt; will automatically set your project&amp;rsquo;s version based on the latest tag in your Git repository. With Versioningit, you can customize the version format using placeholder strings, making it adaptable to your project&amp;rsquo;s specific needs.&lt;/p&gt;&#10;&lt;p&gt;In summary, Versioningit streamlines the package versioning process and simplifies the release workflow. By automating package versioning based on version control repository tags and providing extensive customization options, it helps make the management of package versions more efficient and less error-prone.&lt;/p&gt;&#10;&lt;h2 id="-8-pyprojecttoml-and-pep-621-configuration-consolidation"&gt;📝 8. Pyproject.toml and PEP 621: Configuration Consolidation &lt;a class="anchor" href="#-8-pyprojecttoml-and-pep-621-configuration-consolidation" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;code&gt;pyproject.toml&lt;/code&gt; file plays a crucial role in consolidating configurations and setup for various tools in a Python project, such as Black, Ruff, Mypy, Versioningit, Nox, and pytest. This adherence to &lt;a href="https://www.python.org/dev/peps/pep-0621/" target="_blank" rel="noopener"&gt;PEP 621&lt;/a&gt; standards streamlines the development process by providing a single source of truth for multiple tools, eliminating the need for additional configuration files like &lt;code&gt;setup.cfg&lt;/code&gt; or &lt;code&gt;setup.py&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;By specifying packaging details directly in the &lt;code&gt;pyproject.toml&lt;/code&gt; file, you can efficiently manage your project&amp;rsquo;s dependencies and metadata. For example, the Adaptive Scheduler package demonstrates this approach with a comprehensive &lt;code&gt;pyproject.toml&lt;/code&gt; file containing all the necessary configurations.&lt;/p&gt;&#10;&lt;details&gt;&#10;&lt;summary&gt;(click to unfold):&lt;/summary&gt;&#10;&lt;!-- CODE:START --&gt;&#10;&lt;!-- import urllib.request --&gt;&#10;&lt;!-- url = 'https://raw.githubusercontent.com/basnijholt/adaptive-scheduler/main/pyproject.toml' --&gt;&#10;&lt;!-- print("```toml") --&gt;&#10;&lt;!-- with urllib.request.urlopen(url) as response: --&gt;&#10;&lt;!-- content = response.read() --&gt;&#10;&lt;!-- print(content.decode('utf-8')) --&gt;&#10;&lt;!-- print("```") --&gt;&#10;&lt;!-- CODE:END --&gt;&#10;&lt;!-- OUTPUT:START --&gt;&#10;&lt;!-- ⚠️ This content is auto-generated by `markdown-code-runner`. --&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-toml" data-lang="toml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;build-system&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;build-backend&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;setuptools.build_meta&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;requires&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;setuptools&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;wheel&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;versioningit&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;adaptive_scheduler&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Run many `adaptive.Learner`s on many cores (&amp;gt;10k) using `mpi4py.futures`, `ipyparallel`, `dask-mpi`, or `process-pool`.&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;requires-python&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;gt;=3.8&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;dynamic&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;version&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;maintainers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;Bas Nijholt&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;bas@nijho.lt&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;}]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;license&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;BSD-3&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;classifiers&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Development Status :: 2 - Pre-Alpha&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Intended Audience :: Developers&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Intended Audience :: Science/Research&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;License :: OSI Approved :: BSD License&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Operating System :: OS Independent&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python :: 3&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python :: 3.8&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python :: 3.9&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python :: 3.10&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Programming Language :: Python :: 3.11&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Topic :: Scientific/Engineering&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;Topic :: System :: Distributed Computing&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;dependencies&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;adaptive &amp;gt;= 0.14.1&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;cloudpickle&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;dill&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;ipyparallel&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;ipywidgets&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;itables&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;jinja2&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;loky&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;numpy&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;pandas&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;psutil&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;pyarrow&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;pyzmq&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;rich&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;structlog&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;tinydb&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;toolz&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;tqdm&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;versioningit&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;optional-dependencies&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;all&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;dask-mpi&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;mpi4py&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;test&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;pytest&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pytest-asyncio&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;coverage&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;pytest-cov&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;docs&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;myst-nb&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;sphinx_fontawesome&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;sphinx&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;furo&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;myst-parser&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;emoji&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;urls&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;homepage&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;https://adaptive-scheduler.readthedocs.io/&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;documentation&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;https://adaptive-scheduler.readthedocs.io/&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;repository&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;https://github.com/basnijholt/adaptive-scheduler&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;readme&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;content-type&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;text/x-rst&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;README.rst&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;scripts&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;adaptive-scheduler-launcher&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;adaptive_scheduler._server_support.launcher:main&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;versioningit&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;versioningit&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;onbuild&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;build-file&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;adaptive_scheduler/_version.py&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;source-file&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;adaptive_scheduler/_version.py&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;setuptools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;packages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;find&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;include&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;adaptive_scheduler.*&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;adaptive_scheduler&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pytest&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ini_options&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;addopts&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; -vvv&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --cov=adaptive_scheduler&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --cov-report term&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --cov-report html&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --cov-report xml&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --cov-fail-under=35&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt; --asyncio-mode=auto&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;&amp;#34;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;coverage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;report&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;exclude_lines&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;pragma: no cover&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;raise NotImplementedError&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;if TYPE_CHECKING:&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;if __name__ == .__main__.:&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;black&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;line_length&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;88&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ruff&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;line-length&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;150&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;target-version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;py38&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;select&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;ALL&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;ignore&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;T20&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# flake8-print&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;ANN101&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# Missing type annotation for {name} in method&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;S101&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# Use of assert detected&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;PD901&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# df is a bad variable name. Be kinder to your future self.&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;ANN401&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# Dynamically typed expressions (typing.Any) are disallowed in {name}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;D402&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# First line should not be the function&amp;#39;s signature&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;PLW0603&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# Using the global statement to update `X` is discouraged&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;D401&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# First line of docstring should be in imperative mood&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;SLF001&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;# Private member accessed&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ruff&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;per-file-ignores&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;tests/*&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;SLF001&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;tests/test_examples.py&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;E501&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s2"&gt;&amp;#34;.github/*&amp;#34;&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;INP001&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ruff&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mccabe&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;max-complexity&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mypy&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nx"&gt;python_version&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;3.8&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;!-- OUTPUT:END --&gt;&#10;&lt;/details&gt;&#10;&lt;p&gt;(from &lt;a href="https://github.com/basnijholt/adaptive-scheduler/blob/main/pyproject.toml" target="_blank" rel="noopener"&gt;here&lt;/a&gt;)&lt;/p&gt;&#10;&lt;p&gt;As seen in the example, the &lt;code&gt;pyproject.toml&lt;/code&gt; file includes details about the build system, project metadata, dependencies, optional dependencies, URLs, and configurations for various tools such as Versioningit, setuptools, pytest, coverage, Black, Ruff, and Mypy. By consolidating these configurations, you can maintain a more organized and maintainable project, making it easier to understand and update settings for different tools.&lt;/p&gt;&#10;&lt;p&gt;In summary, the &lt;code&gt;pyproject.toml&lt;/code&gt; file and adherence to PEP 621 provide a unified approach to configuring and setting up your Python project, making it easier to manage dependencies, metadata, and tool-specific settings. This streamlined process ultimately leads to a more efficient and maintainable development workflow.&lt;/p&gt;&#10;&lt;h2 id="-9-github-actions-ci-matrix-testing-on-multiple-platforms-and-auto-publishing-to-pypi"&gt;🌐 9. GitHub Actions CI Matrix: Testing on Multiple Platforms and Auto Publishing to PyPI &lt;a class="anchor" href="#-9-github-actions-ci-matrix-testing-on-multiple-platforms-and-auto-publishing-to-pypi" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/learn-github-actions" target="_blank" rel="noopener"&gt;GitHub Actions&lt;/a&gt; is an excellent tool for automating workflows and improving code quality through continuous integration (CI). By using a CI matrix, you can test your code on multiple platforms and Python versions, ensuring that your package remains compatible and stable across different environments.&lt;/p&gt;&#10;&lt;p&gt;To set up a &lt;code&gt;.github/workflows/nox.yaml&lt;/code&gt; file for GitHub Actions, you can use the following simplified example:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;nox&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;pull_request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;push&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;branches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;main]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;test&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;${{ matrix.platform }}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;strategy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;fail-fast&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;matrix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;platform&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;ubuntu-latest, macos-latest, windows-latest]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;python-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3.8&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3.9&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3.10&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;3.11&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/checkout@v2&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Set up Python ${{ matrix.python-version }}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/setup-python@v2&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;python-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;${{ matrix.python-version }}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Install dependencies&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;pip install nox&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Test with nox&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;nox -e py${{ matrix.python-version }}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This configuration file specifies the platforms and Python versions for testing, as well as the steps to set up the environment, install dependencies, and run tests using nox.&#10;With this simple configuration, you set up tests on MacOS, Windows, Linux, and multiple Python versions, ensuring that your package remains compatible across different environments.&lt;/p&gt;&#10;&lt;p&gt;Another essential part of the CI/CD process is deploying your Python package. You can use the &lt;code&gt;.github/workflows/publish-package.yaml&lt;/code&gt; file to automate the package deployment to PyPI whenever a new release is published:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-yaml" data-lang="yaml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Upload Python Package&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;release&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;types&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="l"&gt;published]&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nt"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;deploy&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;runs-on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;ubuntu-latest&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;steps&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/checkout@v2&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Set up Python&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;uses&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;actions/setup-python@v2&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;with&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;python-version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;3.x&amp;#39;&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Install dependencies&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="sd"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; python -m pip install --upgrade pip&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; pip install setuptools wheel twine build&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;- &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;Build and publish&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TWINE_USERNAME&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;__token__&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;TWINE_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="l"&gt;${{ secrets.PYPI_TOKEN }}&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;run&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="sd"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; python -m build&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="sd"&gt; twine upload dist/*&lt;/span&gt;&lt;span class="w"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This workflow sets up Python, installs necessary dependencies, builds the package, and publishes it to PyPI using Twine. The process integrates seamlessly with versioningit, ensuring that the published package has the correct version number based on the git history.&lt;/p&gt;&#10;&lt;p&gt;In summary, leveraging GitHub Actions for continuous integration and automated workflows enhances code quality and reliability, while also simplifying the development and deployment processes. By testing across various platforms and Python versions, and automating package deployment, you can be confident that your package is well-maintained and accessible to users.&lt;/p&gt;&#10;&lt;h2 id="-10-read-the-docs-sphinx-myst-nb-and-jupytext-notebooks-for-documentation"&gt;📚 10. Read the Docs, Sphinx, MyST-NB, and Jupytext notebooks for documentation &lt;a class="anchor" href="#-10-read-the-docs-sphinx-myst-nb-and-jupytext-notebooks-for-documentation" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Documentation is crucial for any software project, as it helps users understand how to use the package and provides guidance for contributors. &lt;a href="https://readthedocs.org/" target="_blank" rel="noopener"&gt;Read the Docs&lt;/a&gt;, &lt;a href="https://www.sphinx-doc.org/" target="_blank" rel="noopener"&gt;Sphinx&lt;/a&gt;, &lt;a href="https://myst-nb.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;MyST-NB&lt;/a&gt;, and &lt;a href="https://jupytext.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Jupytext notebooks&lt;/a&gt; are powerful tools that, when combined, facilitate the creation and maintenance of high-quality documentation.&lt;/p&gt;&#10;&lt;p&gt;tl;dr: check out the &lt;a href="https://adaptive.readthedocs.io/" target="_blank" rel="noopener"&gt;Adaptive documentation&lt;/a&gt; for an example of how to use these tools to create a comprehensive documentation website.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://readthedocs.org/" target="_blank" rel="noopener"&gt;&lt;strong&gt;Read the Docs&lt;/strong&gt;&lt;/a&gt; is a documentation hosting platform that automatically builds, version controls, and hosts your documentation for free. It integrates well with Sphinx and GitHub, allowing your documentation to be updated whenever you push changes to your repository.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://www.sphinx-doc.org/" target="_blank" rel="noopener"&gt;&lt;strong&gt;Sphinx&lt;/strong&gt;&lt;/a&gt; is a documentation generator that can transform reStructuredText files, MyST files, or Jupyter notebooks into various output formats, such as HTML, LaTeX, or PDF. It is highly extensible, supporting custom themes and plugins, and can automatically generate API documentation from your Python code.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://myst-nb.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;&lt;strong&gt;MyST-NB&lt;/strong&gt;&lt;/a&gt; is an extension to Sphinx that enables it to parse Jupyter notebooks and execute the code cells during the build process. It uses the MyST (short for Markedly Structured Text) markdown parser, which adds support for Sphinx roles and directives, making it a powerful alternative to reStructuredText.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://jupytext.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;&lt;strong&gt;Jupytext notebooks&lt;/strong&gt;&lt;/a&gt; is a Jupyter extension that enables you to save Jupyter notebooks in Markdown format (or other text-based formats) instead of the default JSON format. By using Jupytext notebooks, you can store your code, explanations, and visualizations as plain text, which is easier to version control and can be seamlessly integrated with MyST-NB and Sphinx.&lt;/p&gt;&#10;&lt;p&gt;With &lt;a href="https://myst-nb.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;MyST-NB&lt;/a&gt; and &lt;a href="https://jupytext.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Jupytext&lt;/a&gt;, you can write your documentation using Jupyter notebooks in Markdown format. This approach combines the benefits of Jupyter notebooks, such as interactive code execution and rich output, with the simplicity of Markdown and the powerful features of Sphinx. The result is a highly readable, user-friendly, and maintainable documentation that caters to both users and developers.&lt;/p&gt;&#10;&lt;p&gt;To get started with MyST-NB, you&amp;rsquo;ll need to install it using pip:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;pip install myst-nb&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next, configure your Sphinx project to use MyST-NB by adding the following lines to your &lt;code&gt;conf.py&lt;/code&gt; file:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-python" data-lang="python"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;extensions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;myst_nb&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, Sphinx will be able to parse and execute your Jupyter notebooks during the documentation build process, integrating them seamlessly with your existing documentation.&lt;/p&gt;&#10;&lt;p&gt;In summary, using Read the Docs, Sphinx, MyST-NB, and Jupytext notebooks for your documentation enables you to create high-quality, interactive, and easily maintainable documentation that benefits your project&amp;rsquo;s users and contributors. This combination of tools ensures that your documentation remains up-to-date, easily navigable, and engaging, ultimately enhancing the overall experience for your project&amp;rsquo;s audience.&lt;/p&gt;&#10;&lt;p&gt;For a full example, see how I setup &lt;a href="https://adaptive.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Adaptive&amp;rsquo;s documentation&lt;/a&gt; using Sphinx, MyST-NB, and Jupytext notebooks. &lt;a href="https://github.com/python-adaptive/adaptive/blob/1b0f15e44235643731c56d335f6711c5584d4828/readthedocs.yml" target="_blank" rel="noopener"&gt;&lt;code&gt;readthedocs.yaml&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/python-adaptive/adaptive/blob/1b0f15e44235643731c56d335f6711c5584d4828/docs/source/conf.py" target="_blank" rel="noopener"&gt;&lt;code&gt;docs/source/conf.py&lt;/code&gt;&lt;/a&gt;, and here is an example notebook that is used in the &lt;a href="https://adaptive.readthedocs.io/en/latest/tutorial/tutorial.Learner1D.html" target="_blank" rel="noopener"&gt;documentation&lt;/a&gt;: &lt;a href="https://github.com/python-adaptive/adaptive/blob/main/docs/source/tutorial/tutorial.Learner1D.md" target="_blank" rel="noopener"&gt;&lt;code&gt;docs/source/tutorial/tutorial.Learner1D.md&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;&#10;&lt;h2 id="-11-conclusion"&gt;🎉 11. Conclusion &lt;a class="anchor" href="#-11-conclusion" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;In conclusion, incorporating these powerful tools into your Python development workflow can significantly enhance your productivity and code quality. By adopting &lt;a href="https://pre-commit.com/" target="_blank" rel="noopener"&gt;pre-commit&lt;/a&gt;, &lt;a href="https://black.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Black&lt;/a&gt;, &lt;a href="https://beta.ruff.rs/docs/rules/" target="_blank" rel="noopener"&gt;Ruff&lt;/a&gt;, &lt;a href="https://mypy.readthedocs.io/en/stable/" target="_blank" rel="noopener"&gt;Mypy&lt;/a&gt;, &lt;a href="https://versioningit.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Versioningit&lt;/a&gt;, &lt;a href="https://www.python.org/dev/peps/pep-0621/" target="_blank" rel="noopener"&gt;Pyproject.toml with PEP 621&lt;/a&gt;, &lt;a href="https://nox.thea.codes/en/stable/" target="_blank" rel="noopener"&gt;Nox&lt;/a&gt;, &lt;a href="https://docs.pytest.org/" target="_blank" rel="noopener"&gt;pytest&lt;/a&gt;, &lt;a href="https://docs.github.com/en/actions/learn-github-actions" target="_blank" rel="noopener"&gt;GitHub Actions CI matrix&lt;/a&gt;, and &lt;a href="https://readthedocs.org/" target="_blank" rel="noopener"&gt;Read the Docs&lt;/a&gt;, &lt;a href="https://www.sphinx-doc.org/" target="_blank" rel="noopener"&gt;Sphinx&lt;/a&gt;, &lt;a href="https://myst-nb.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;MyST-NB&lt;/a&gt;, and &lt;a href="https://jupytext.readthedocs.io/en/latest/" target="_blank" rel="noopener"&gt;Jupytext notebooks&lt;/a&gt; for documentation, you create a streamlined, efficient, and reliable development environment.&lt;/p&gt;&#10;&lt;p&gt;These tools help maintain code consistency, catch issues early, automate package versioning, simplify testing, consolidate configurations, and create high-quality documentation. By integrating them into your projects, you can focus on writing great code while ensuring that your work remains robust, maintainable, and accessible to users and contributors alike.&lt;/p&gt;&#10;&lt;p&gt;Don&amp;rsquo;t hesitate to explore these tools and incorporate them into your Python development toolkit. They can transform your development experience, making it more enjoyable and efficient, ultimately leading to higher-quality projects and happier developers. Happy coding!&lt;/p&gt;&#10;</description></item><item><title>Working faster in the terminal 🥷</title><link>https://www.nijho.lt/post/terminal-ninja/</link><pubDate>Sat, 15 Apr 2023 00:00:00 +0000</pubDate><guid isPermaLink="false">/post/terminal-ninja/</guid><description>&lt;aside class="callout callout-warning"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"/&gt;&lt;/svg&gt;&lt;div&gt;Originally written in April 2023 but slightly updated in March 2025.&#10;Since then, I have published my entire &lt;a href="https://github.com/basnijholt/dotfiles" target="_blank" rel="noopener"&gt;&lt;code&gt;dotfiles&lt;/code&gt;&lt;/a&gt; repo, see the &lt;a href="https://www.nijho.lt/post/dotfiles/" target="_blank" rel="noopener"&gt;dotfiles blog post&lt;/a&gt; for more details.&#10;Since writing this post, I switched from &lt;code&gt;z-zsh&lt;/code&gt; to &lt;a href="https://github.com/ajeetdsouza/zoxide" target="_blank" rel="noopener"&gt;&lt;code&gt;zoxide&lt;/code&gt;&lt;/a&gt;, and from &lt;code&gt;autoenv&lt;/code&gt; to &lt;a href="https://direnv.net/" target="_blank" rel="noopener"&gt;&lt;code&gt;direnv&lt;/code&gt;&lt;/a&gt;, and am using a bunch of other modern CLI tools.&lt;/div&gt;&lt;/aside&gt;&#10;&lt;p&gt;Welcome to a world of terminal productivity!&#10;When helping others with programming problems on their computer, I often find myself in their terminal, and feel like walking through sand.&#10;When I show how awesome of an experience it can be, I often find myself repeating the same suggestions over and over again.&#10;So, I decided to write this guide to help others set up their terminal in a similar fashion.&#10;Let&amp;rsquo;s explore the wonders of &lt;a href="https://www.zsh.org/" target="_blank" rel="noopener"&gt;&lt;code&gt;zsh&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://ohmyz.sh/" target="_blank" rel="noopener"&gt;&lt;code&gt;oh-my-zsh&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://wiki.gentoo.org/wiki/Keychain" target="_blank" rel="noopener"&gt;&lt;code&gt;keychain&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://starship.rs/" target="_blank" rel="noopener"&gt;&lt;code&gt;starship&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/hyperupcall/autoenv" target="_blank" rel="noopener"&gt;&lt;code&gt;autoenv&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/agkozak/zsh-z" target="_blank" rel="noopener"&gt;&lt;code&gt;z&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://github.com/zsh-users/zsh-autosuggestions" target="_blank" rel="noopener"&gt;&lt;code&gt;zsh-autosuggestions&lt;/code&gt;&lt;/a&gt;, and other useful tools!&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://camo.githubusercontent.com/18cdb04e93fe276412b588dbed23bc328614bf7a4d09ea4d8862d38f1c466c65/687474703a2f2f6d656469612e74756d626c722e636f6d2f74756d626c725f6c74757a6a766251364c31717a677078392e676966" alt="" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;details class="toc" open&gt;&lt;summary&gt;Table of contents&lt;/summary&gt;&lt;nav id="TableOfContents"&gt;&#10; &lt;ul&gt;&#10; &lt;li&gt;&lt;a href="#-dotfiles-version-control-your-configuration-files"&gt;💾 Dotfiles: Version Control Your Configuration Files&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-the-power-of-zsh-and-oh-my-zsh"&gt;🐚 The Power of Zsh and Oh-my-zsh&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-oh-my-zsh-z-plugin-jump-around"&gt;🚀 Oh-my-zsh Z Plugin: Jump Around!&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-oh-my-zsh-dirhistory-plugin-time-travel-through-directories"&gt;⏰ Oh-my-zsh Dirhistory Plugin: Time Travel Through Directories&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-oh-my-zsh-git-plugin-turbocharge-your-git-workflow"&gt;🔧 Oh-my-zsh Git Plugin: Turbocharge Your Git Workflow&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-keychain-ssh-key-management-made-simple"&gt;🔑 Keychain: SSH Key Management Made Simple&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-starship-a-sleek-informative-shell-prompt"&gt;🌌 Starship: A Sleek, Informative Shell Prompt&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-autoenv-smart-environment-management"&gt;🌍 Autoenv: Smart Environment Management&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-zsh-autosuggestions-command-suggestions-as-you-type"&gt;💡 Zsh-autosuggestions: Command Suggestions as You Type&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-bat-a-supercharged-cat-alternative"&gt;🦇 Bat: A Supercharged Cat Alternative&lt;/a&gt;&lt;/li&gt;&#10; &lt;li&gt;&lt;a href="#-putting-it-all-together"&gt;🧩 Putting it All Together&lt;/a&gt;&lt;/li&gt;&#10; &lt;/ul&gt;&#10;&lt;/nav&gt;&lt;/details&gt;&#10;&#10;&lt;h2 id="-dotfiles-version-control-your-configuration-files"&gt;💾 Dotfiles: Version Control Your Configuration Files &lt;a class="anchor" href="#-dotfiles-version-control-your-configuration-files" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Configuration files are the key to a personalized terminal experience.&#10;Keeping a &lt;code&gt;dotfiles&lt;/code&gt; folder where you store and version control your config files ensures they&amp;rsquo;re safe, portable, and easily shared.&lt;/p&gt;&#10;&lt;p&gt;By keeping your &lt;code&gt;.bashrc&lt;/code&gt;, &lt;code&gt;.zshrc&lt;/code&gt;, and other configuration files under version control, you can:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;Track changes and easily revert to previous versions if something breaks.&lt;/li&gt;&#10;&lt;li&gt;Sync your settings across multiple machines, recreating your setup anywhere.&lt;/li&gt;&#10;&lt;li&gt;Share your configurations with others, helping them improve their own terminal experience.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;A powerful approach is to not only track your configuration files but also to include plugins and tools as git submodules in your dotfiles repository. This keeps everything organized and makes it easy to update or share your complete setup.&lt;/p&gt;&#10;&lt;p&gt;Here&amp;rsquo;s an example of submodules I track in my dotfiles repository:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;configs/zsh/oh-my-zsh&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/oh-my-zsh&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:robbyrussell/oh-my-zsh.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;configs/zsh/zsh-syntax-highlighting&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/zsh-syntax-highlighting&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:zsh-users/zsh-syntax-highlighting.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;configs/zsh/zsh-autosuggestions&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/zsh-autosuggestions&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:zsh-users/zsh-autosuggestions.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;submodules/keychain&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/keychain&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:funtoo/keychain.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;configs/zsh/k&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/k&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:supercrabtree/k.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;submodules/.tmux&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/tmux&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; https://github.com/gpakosz/.tmux.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;configs/zsh/autoenv&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/autoenv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; https://github.com/hyperupcall/autoenv&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;submodules/bypass-paywalls-chrome&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/bypass-paywalls-chrome&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; git@github.com:iamadamdev/bypass-paywalls-chrome.git&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;submodules/dotbot&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; submodules/dotbot&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; https://github.com/anishathalye/dotbot&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;submodule &lt;span class="s2"&gt;&amp;#34;dotbot&amp;#34;&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#9;&lt;span class="nv"&gt;ignore&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; dirty&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# (... a couple more ...)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To start version controlling your dotfiles, create a new Git repository, add your config files and submodules, then commit and push to a remote repository for safekeeping.&lt;/p&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/anishathalye/dotbot" target="_blank" rel="noopener"&gt;Dotbot&lt;/a&gt; is highly recommended for automating the installation of your dotfiles.&lt;/p&gt;&#10;&lt;aside class="callout callout-note"&gt;&lt;svg class="ico" viewBox="0 0 256 256" aria-hidden="true"&gt;&lt;path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"/&gt;&lt;/svg&gt;&lt;div&gt;Although I keep my dotfiles in a Git repository, I have not made it public. I might do so in the future, let me know if you&amp;rsquo;re interested!&lt;/div&gt;&lt;/aside&gt;&#10;&lt;h2 id="-the-power-of-zsh-and-oh-my-zsh"&gt;🐚 The Power of Zsh and Oh-my-zsh &lt;a class="anchor" href="#-the-power-of-zsh-and-oh-my-zsh" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The first step toward terminal efficiency is choosing the right shell.&#10;Zsh is a powerful, versatile, and user-friendly shell with features that significantly improve the command line experience.&#10;Oh-my-zsh adds even more functionality as a framework for managing Zsh configurations.&#10;It brings themes, plugins, and functions that make the terminal more powerful and enjoyable to use.&lt;/p&gt;&#10;&lt;p&gt;Setting up Zsh and Oh-my-zsh is straightforward:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Install Zsh (check your system&amp;rsquo;s package manager for instructions).&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Install Oh-my-zsh by running:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sh -c &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Edit your &lt;code&gt;.zshrc&lt;/code&gt; file and add the following lines to customize your plugins and theme:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;ZSH_THEME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;robbyrussell&amp;#34;&lt;/span&gt; &lt;span class="c1"&gt;# or any other theme you like&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;git z dirhistory &lt;span class="nb"&gt;history&lt;/span&gt; sudo&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="-oh-my-zsh-z-plugin-jump-around"&gt;🚀 Oh-my-zsh Z Plugin: Jump Around! &lt;a class="anchor" href="#-oh-my-zsh-z-plugin-jump-around" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;Quick navigation through the file system is essential for productivity.&#10;&lt;a href="https://github.com/agkozak/zsh-z" target="_blank" rel="noopener"&gt;Z&lt;/a&gt; is a fantastic utility that lets you jump to directories based on frequency and recency of use.&#10;With Z, you can instantly leap to any frequently-used folder without typing the full path.&lt;/p&gt;&#10;&lt;p&gt;To set up Z, add the following lines to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;... z ...&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &lt;span class="nv"&gt;$ZSH&lt;/span&gt;/oh-my-zsh.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure&gt;&lt;img src="https://github.com/agkozak/zsh-z/raw/da8dee3ccaf882d1bf653c34850041025616ceb5/img/demo.gif" alt="" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;p&gt;Alternative: &lt;a href="https://github.com/ajeetdsouza/zoxide" target="_blank" rel="noopener"&gt;zoxide&lt;/a&gt;, a more modern and faster version of Z in Rust.&#10;Need to try it myself.&lt;/p&gt;&#10;&lt;h2 id="-oh-my-zsh-dirhistory-plugin-time-travel-through-directories"&gt;⏰ Oh-my-zsh Dirhistory Plugin: Time Travel Through Directories &lt;a class="anchor" href="#-oh-my-zsh-dirhistory-plugin-time-travel-through-directories" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;The &lt;code&gt;dirhistory&lt;/code&gt; plugin makes navigating directories incredibly simple with keyboard shortcuts:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;strong&gt;ALT-LEFT&lt;/strong&gt;: Move back to previously visited directories.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;ALT-RIGHT&lt;/strong&gt;: Undo the effect of ALT-LEFT, returning to the directories you moved back from.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;ALT-UP&lt;/strong&gt;: Move up one level in the directory hierarchy (equivalent to &lt;code&gt;cd ..&lt;/code&gt;).&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;ALT-DOWN&lt;/strong&gt;: Move into the first directory found in alphabetical order within the current directory.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;To set up the Oh-my-zsh &lt;code&gt;dirhistory&lt;/code&gt; plugin, add the following lines to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;... dirhistory ...&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &lt;span class="nv"&gt;$ZSH&lt;/span&gt;/oh-my-zsh.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This plugin makes directory navigation a breeze, reducing the need for repetitive typing.&lt;/p&gt;&#10;&lt;h2 id="-oh-my-zsh-git-plugin-turbocharge-your-git-workflow"&gt;🔧 Oh-my-zsh Git Plugin: Turbocharge Your Git Workflow &lt;a class="anchor" href="#-oh-my-zsh-git-plugin-turbocharge-your-git-workflow" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;For developers who use Git frequently, typing out full commands like &lt;code&gt;git checkout&lt;/code&gt; and &lt;code&gt;git commit&lt;/code&gt; gets tedious.&#10;&lt;a href="https://github.com/ohmyzsh/ohmyzsh/tree/5d3e86e2a48adf7a308773f8f1b725d187c7c5ef/plugins/git#git-plugin" target="_blank" rel="noopener"&gt;The &lt;code&gt;git&lt;/code&gt; plugin&lt;/a&gt; in Oh-my-zsh provides useful aliases that save time and keystrokes.&#10;Here are some of the most commonly used aliases:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;code&gt;gco&lt;/code&gt;: &lt;code&gt;git checkout&lt;/code&gt; - Switch branches or restore working tree files.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gd&lt;/code&gt;: &lt;code&gt;git diff&lt;/code&gt; - Show changes between the working tree and the index or a tree.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;g&lt;/code&gt;: &lt;code&gt;git&lt;/code&gt; - The git command itself.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gcb&lt;/code&gt;: &lt;code&gt;git checkout -b&lt;/code&gt; - Create a new branch and switch to it.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gc&lt;/code&gt;: &lt;code&gt;git commit --verbose&lt;/code&gt; - Create a new commit with a verbose message.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gc!&lt;/code&gt;: &lt;code&gt;git commit --verbose --amend&lt;/code&gt; - Amend the previous commit with a verbose message.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;ga&lt;/code&gt;: git add - Add file contents to the index.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gca&lt;/code&gt;: &lt;code&gt;git commit --verbose --all&lt;/code&gt; - Commit all changes with a verbose message.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gca!&lt;/code&gt;: &lt;code&gt;git commit --verbose --all --amend&lt;/code&gt; - Amend the previous commit with a verbose message.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gcp&lt;/code&gt;: &lt;code&gt;git cherry-pick&lt;/code&gt; - Apply the changes introduced by some existing commits.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gst&lt;/code&gt;: &lt;code&gt;git status&lt;/code&gt; - Show the working tree status.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gp&lt;/code&gt;: &lt;code&gt;git push&lt;/code&gt; - Update remote refs along with associated objects.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gmom&lt;/code&gt;: &lt;code&gt;git merge origin/$(git_main_branch)&lt;/code&gt; - Merge changes from the main branch.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;grbom&lt;/code&gt;: &lt;code&gt;git rebase origin/$(git_main_branch)&lt;/code&gt; - Rebase current branch onto the main branch.&lt;/li&gt;&#10;&lt;li&gt;&lt;code&gt;gfa&lt;/code&gt;: &lt;code&gt;git fetch --all --prune --jobs=10&lt;/code&gt; - Fetch all remote branches and remove any stale remote-tracking references, using 10 parallel jobs.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;To set up the Oh-my-zsh &lt;code&gt;git&lt;/code&gt; plugin, add the following lines to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;plugins&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;... git ...&lt;span class="o"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &lt;span class="nv"&gt;$ZSH&lt;/span&gt;/oh-my-zsh.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Check out the full list of &lt;a href="https://github.com/ohmyzsh/ohmyzsh/tree/5d3e86e2a48adf7a308773f8f1b725d187c7c5ef/plugins/git#git-plugin" target="_blank" rel="noopener"&gt;Git aliases&lt;/a&gt; that the Git plugin provides.&lt;/p&gt;&#10;&lt;h2 id="-keychain-ssh-key-management-made-simple"&gt;🔑 Keychain: SSH Key Management Made Simple &lt;a class="anchor" href="#-keychain-ssh-key-management-made-simple" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://wiki.gentoo.org/wiki/Keychain" target="_blank" rel="noopener"&gt;Keychain&lt;/a&gt; is a tool that manages SSH keys, making secure access to remote systems much more convenient.&#10;It&amp;rsquo;s especially useful when working with Git repositories or remote servers via SSH.&lt;/p&gt;&#10;&lt;p&gt;With Keychain, you only need to &lt;em&gt;&lt;strong&gt;enter your SSH password once&lt;/strong&gt;&lt;/em&gt; after rebooting, and it will remember it for future sessions.&lt;/p&gt;&#10;&lt;p&gt;To set up Keychain, clone it to your dotfiles directory:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone git@github.com:funtoo/keychain.git ~/dotfiles/keychain&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then add these lines to your &lt;code&gt;.bash_profile&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;hostname&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Linux&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$PATH&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/dotfiles/dotfiles/keychain/&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;if&lt;/span&gt; ps -p &lt;span class="nv"&gt;$SSH_AGENT_PID&lt;/span&gt; &amp;gt; /dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;ssh-agent is already running&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;else&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;keychain --eval --quiet id_ed25519&lt;span class="sb"&gt;`&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[[&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;uname&lt;span class="sb"&gt;`&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Darwin&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="sb"&gt;`&lt;/span&gt;keychain --eval --quiet --agents ssh --inherit any-once id_ed25519&lt;span class="sb"&gt;`&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="-starship-a-sleek-informative-shell-prompt"&gt;🌌 Starship: A Sleek, Informative Shell Prompt &lt;a class="anchor" href="#-starship-a-sleek-informative-shell-prompt" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://starship.rs/" target="_blank" rel="noopener"&gt;Starship&lt;/a&gt; is a minimal, blazing-fast, and fully customizable shell prompt that provides essential information at a glance.&#10;It shows details about your current environment, such as Git branch, Python virtual environment, and more.&lt;/p&gt;&#10;&lt;p&gt;Setting up Starship is simple:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Install it using the appropriate command for your system:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -fsSL https://starship.rs/install.sh &lt;span class="p"&gt;|&lt;/span&gt; bash&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Add the following line to your &lt;code&gt;.bashrc&lt;/code&gt; or &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;eval&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;starship init zsh&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;video controls&gt;&#10; &lt;source src="https://starship.rs/demo.webm" type="video/webm"&gt;&#10; Your browser does not support the video tag.&#10;&lt;/video&gt;&#10;&lt;h2 id="-autoenv-smart-environment-management"&gt;🌍 Autoenv: Smart Environment Management &lt;a class="anchor" href="#-autoenv-smart-environment-management" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;When working with multiple projects, each often requires specific environment settings.&#10;&lt;a href="https://github.com/hyperupcall/autoenv" target="_blank" rel="noopener"&gt;Autoenv&lt;/a&gt; automates the process of activating and deactivating these settings when you enter or leave a directory.&lt;/p&gt;&#10;&lt;p&gt;For example, you can create a &lt;code&gt;.env&lt;/code&gt; file in your project directory to automatically activate a Python environment:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;conda activate myenv&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To set up Autoenv:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Clone the repository (or add it to your &lt;code&gt;dotfiles&lt;/code&gt;):&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone git://github.com/hyperupcall/autoenv.git ~/.autoenv&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Add the following line to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; ~/.autoenv/activate.sh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;h2 id="-zsh-autosuggestions-command-suggestions-as-you-type"&gt;💡 Zsh-autosuggestions: Command Suggestions as You Type &lt;a class="anchor" href="#-zsh-autosuggestions-command-suggestions-as-you-type" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/zsh-users/zsh-autosuggestions" target="_blank" rel="noopener"&gt;Zsh-autosuggestions&lt;/a&gt; suggests commands based on your command history as you type.&#10;This saves keystrokes and makes repetitive tasks much faster.&lt;/p&gt;&#10;&lt;p&gt;To set up Zsh-autosuggestions:&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Clone the repository:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone https://github.com/zsh-users/zsh-autosuggestions.git &lt;span class="nv"&gt;$ZSH_CUSTOM&lt;/span&gt;/plugins/zsh-autosuggestions&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;Add the following line to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;source&lt;/span&gt; &lt;span class="nv"&gt;$ZSH_CUSTOM&lt;/span&gt;/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;figure&gt;&lt;img src="https://user-images.githubusercontent.com/6897215/233818577-189256ff-b1e2-4790-984e-6fd191df5c00.gif" alt="" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;p&gt;Alternative: &lt;a href="https://direnv.net/" target="_blank" rel="noopener"&gt;&lt;code&gt;direnv&lt;/code&gt;&lt;/a&gt;, very similar to &lt;code&gt;autoenv&lt;/code&gt;, but seems more widely used.&#10;Still need to try it myself.&lt;/p&gt;&#10;&lt;h2 id="-bat-a-supercharged-cat-alternative"&gt;🦇 Bat: A Supercharged Cat Alternative &lt;a class="anchor" href="#-bat-a-supercharged-cat-alternative" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;&lt;a href="https://github.com/sharkdp/bat" target="_blank" rel="noopener"&gt;Bat&lt;/a&gt; is a modern replacement for the &lt;code&gt;cat&lt;/code&gt; command with syntax highlighting, Git integration, and other enhancements that make viewing files in the terminal much more pleasant.&lt;/p&gt;&#10;&lt;p&gt;Installing Bat is straightforward with most package managers:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;brew install bat &lt;span class="c1"&gt;# macOS&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;apt install bat &lt;span class="c1"&gt;# Ubuntu/Debian&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To seamlessly replace &lt;code&gt;cat&lt;/code&gt; with &lt;code&gt;bat&lt;/code&gt; while maintaining the simple behavior when needed, add this to your &lt;code&gt;.zshrc&lt;/code&gt;:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;command&lt;/span&gt; -v bat &lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt; /dev/null&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="nb"&gt;alias&lt;/span&gt; &lt;span class="nv"&gt;cat&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;bat --plain --paging=never&amp;#34;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;fi&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This alias makes &lt;code&gt;bat&lt;/code&gt; behave like &lt;code&gt;cat&lt;/code&gt; by default (without line numbers or fancy formatting), but you can still use the &lt;code&gt;bat&lt;/code&gt; command directly when you want the enhanced features.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://imgur.com/rGsdnDe.png" alt="" loading="lazy" data-zoomable&gt;&lt;/figure&gt;&lt;p&gt;Bat is particularly useful when viewing code files, configuration files, or any text that benefits from syntax highlighting, making it easier to quickly understand the content at a glance.&lt;/p&gt;&#10;&lt;h2 id="-putting-it-all-together"&gt;🧩 Putting it All Together &lt;a class="anchor" href="#-putting-it-all-together" aria-label="Link to this section"&gt;#&lt;/a&gt;&lt;/h2&gt;&#10;&lt;p&gt;With these powerful tools at your disposal, you&amp;rsquo;re now equipped to make your terminal experience faster, more efficient, and more enjoyable.&#10;These tools work together to reduce repetitive typing, simplify complex workflows, and provide helpful information when you need it.&#10;Each component adds something valuable to your terminal setup, creating a seamless and productive environment.&lt;/p&gt;&#10;&lt;p&gt;Try implementing these tools one by one, and see how they transform your command-line experience.&#10;Feel free to reach out if you have questions about any of the tools mentioned.&#10;Happy terminal customizing!&lt;/p&gt;&#10;</description></item></channel></rss>