<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Papan Sarkar</title>
    <description>The latest articles on DEV Community by Papan Sarkar (@papansarkar101).</description>
    <link>https://dev.to/papansarkar101</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F484187%2F90c599ad-5923-4126-bc31-b511f2532f3f.PNG</url>
      <title>DEV Community: Papan Sarkar</title>
      <link>https://dev.to/papansarkar101</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/papansarkar101"/>
    <language>en</language>
    <item>
      <title>Should You Run Django on Free-Threaded Python Yet?</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Mon, 16 Nov 2026 04:30:19 +0000</pubDate>
      <link>https://dev.to/papansarkar101/should-you-run-django-on-free-threaded-python-yet-4g4l</link>
      <guid>https://dev.to/papansarkar101/should-you-run-django-on-free-threaded-python-yet-4g4l</guid>
      <description>&lt;p&gt;A client asked me in September whether we could get more out of the four-core box their Django app runs on without paying for a bigger one. The honest answer was to try the free-threaded build, so I spent an afternoon on it. The build itself was easy. Then &lt;code&gt;uv pip install 'psycopg[binary]'&lt;/code&gt; failed, and the afternoon turned into a different kind of lesson: the framework is further along than the driver stack underneath it, and the driver stack is what decides whether you can ship.&lt;/p&gt;

&lt;p&gt;Here is what I found, what I'd tell a client today, and the one place free-threading is already worth the trouble.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Django actually claims right now
&lt;/h2&gt;

&lt;p&gt;Django's &lt;code&gt;main&lt;/code&gt; branch carries the trove classifier &lt;a href="https://github.com/django/django/blob/main/pyproject.toml" rel="noopener noreferrer"&gt;&lt;code&gt;Programming Language :: Python :: Free Threading :: 2 - Beta&lt;/code&gt;&lt;/a&gt; and pins &lt;code&gt;asgiref&amp;gt;=3.12.1&lt;/code&gt;. That classifier is a real signal — it went in with &lt;a href="https://github.com/django/django/pull/21623" rel="noopener noreferrer"&gt;a pull request that also enabled a &lt;code&gt;ubuntu-free-threading&lt;/code&gt; job in CI&lt;/a&gt; — but read the words. "2 - Beta" is not "5 - Production/Stable", and the PR was explicitly not backported to &lt;code&gt;stable/6.1&lt;/code&gt;. If you install Django from PyPI today, you are not running the code that gets tested on a free-threaded interpreter.&lt;/p&gt;

&lt;p&gt;The version matrix matters too. &lt;a href="https://docs.djangoproject.com/en/dev/faq/install/" rel="noopener noreferrer"&gt;Django 6.1 and 6.2 both support Python 3.12, 3.13 and 3.14&lt;/a&gt; — no 3.15, whose &lt;a href="https://devguide.python.org/versions/" rel="noopener noreferrer"&gt;first release was scheduled for 2026-10-09&lt;/a&gt;. So the only free-threaded target that Django supports at all is 3.14t. And the tracking ticket, &lt;a href="https://code.djangoproject.com/ticket/36983" rel="noopener noreferrer"&gt;Django #36983&lt;/a&gt;, is still open at triage stage "Someday/Maybe" with component Core (Other). The same ticket notes that 3.13t was dropped from the test matrix over potential memory leaks from dynamically created classes.&lt;/p&gt;

&lt;p&gt;So: supported enough to test, not supported enough to promise. That is a reasonable place for a framework to be, and it is a bad place to put a client's production traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  The driver is the wall
&lt;/h2&gt;

&lt;p&gt;Django's own docs say &lt;a href="https://docs.djangoproject.com/en/stable/ref/databases/" rel="noopener noreferrer"&gt;psycopg 3.1.12+ is the recommended PostgreSQL driver&lt;/a&gt;, and that psycopg2 support "is likely to be deprecated and removed at some point in the future." Connection pooling via &lt;code&gt;"pool": True&lt;/code&gt; is psycopg 3 only. For a Postgres-backed Django app, psycopg is not optional.&lt;/p&gt;

&lt;p&gt;psycopg's free-threading work lives in &lt;a href="https://github.com/psycopg/psycopg/issues/1095" rel="noopener noreferrer"&gt;issue #1095&lt;/a&gt;, and it is not finished. The maintainer's position there is unambiguous: "Work is ongoing but not finished yet", "Binary packages will only be released when we will declare the support complete", and until then "support is experimental: use it at your risk." Asked about shipping a binary that disables the GIL, he answered: "Not at the moment, no. I don't want to do anything that may destabilize the binary." A report on that same thread is exactly the failure I hit — &lt;code&gt;psycopg-binary&lt;/code&gt; ships &lt;code&gt;cp314&lt;/code&gt; wheels but no &lt;code&gt;cp314t&lt;/code&gt;, so the install resolves to nothing on a free-threaded interpreter.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://py-free-threading.github.io/tracking/" rel="noopener noreferrer"&gt;community compatibility tracker&lt;/a&gt; tells the same story with more context: psycopg has an upstream issue and no listed first-supported version, while Pillow landed support in 11.0.0, NumPy in 2.1.0, and cryptography in 46.0.0. The scientific stack got there first. The web stack did not.&lt;/p&gt;

&lt;p&gt;This is worse than a missing wheel, because the failure mode is quiet. Importing a C extension that is not marked free-threading-safe &lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;can automatically re-enable the GIL, with a warning printed&lt;/a&gt;. You can end up running a free-threaded interpreter with the GIL switched back on — paying the single-threaded overhead, getting none of the parallelism, and only finding out if someone reads the logs. If you try this at all, assert it at boot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# myproject/apps.py&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sysconfig&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;warnings&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;apps&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;AppConfig&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;ImproperlyConfigured&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CoreConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;AppConfig&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"core"&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;sysconfig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_config_var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Py_GIL_DISABLED"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;  &lt;span class="c1"&gt;# ordinary build, nothing to check&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_is_gil_enabled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ImproperlyConfigured&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="s2"&gt;"Free-threaded build detected but the GIL is enabled again. "&lt;/span&gt;
                &lt;span class="s2"&gt;"Some C extension re-enabled it; check import warnings."&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;warnings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;warn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Running free-threaded with the GIL disabled."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stacklevel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sysconfig.get_config_var("Py_GIL_DISABLED")&lt;/code&gt; is the &lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;documented way to branch on the build&lt;/a&gt;, and &lt;code&gt;sys._is_gil_enabled()&lt;/code&gt; reports what the running process actually does. Use both. The build and the runtime state are different questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the overhead actually costs
&lt;/h2&gt;

&lt;p&gt;The deal you are offered is: give up some single-threaded speed, get real parallelism across threads. The published numbers are narrower than the hype. CPython's own how-to puts the single-threaded overhead at &lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;about 1% on macOS aarch64 to 8% on x86-64 Linux&lt;/a&gt;, workload-dependent. &lt;a href="https://peps.python.org/pep-0779/" rel="noopener noreferrer"&gt;PEP 779 set a hard target of 15% slower than the with-GIL build and noted the figure was around 10%, with a 20% memory target&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Memory is the part people skip. On the free-threaded build, interned strings are immortal, the allocator is mimalloc rather than pymalloc, and non-GC objects carry a larger header — &lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;&lt;code&gt;None&lt;/code&gt; is 32 bytes instead of 16 on AMD64&lt;/a&gt;. Deferred and per-thread reference counting mean some memory is freed by the collector rather than at zero refcount, so RSS does not fall when you expect it to. On a small VPS that is a real line item, and it lands on the same box you were trying to squeeze.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Django itself still contends
&lt;/h2&gt;

&lt;p&gt;Even with a perfect driver, Django's internals were written under the assumption that one thread runs Python at a time. The &lt;a href="https://forum.djangoproject.com/t/improve-free-threading-performance/44497" rel="noopener noreferrer"&gt;Django forum thread on free-threading performance&lt;/a&gt; is the best reading on this, because CPython's Sam Gross names specific hot spots rather than hand-waving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Field.creation_counter&lt;/code&gt;, a shared class-level counter, is contended and invalidates CPython's attribute lookup cache — and some code paths create temporary &lt;code&gt;Field&lt;/code&gt; instances per request, such as &lt;code&gt;AutoField.rel_db_type&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;functools.lru_cache&lt;/code&gt; with a bound scales badly, because a strict LRU policy updates metadata on every hit.&lt;/li&gt;
&lt;li&gt;Lock contention on the set lookup in &lt;code&gt;HttpHeaders.UNPREFIX_HEADERS&lt;/code&gt;, which a frozenset would fix.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are not exotic edge cases; they are the request path. The thread also records the disagreement that makes this slow to fix: moving &lt;code&gt;creation_counter&lt;/code&gt; assignment into &lt;code&gt;contribute_to_class&lt;/code&gt; would change field ordering, and at least one third-party package depends on that ordering. This is normal framework maintenance, and it is why the ticket is open rather than closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd actually do
&lt;/h2&gt;

&lt;p&gt;Split the tiers. Keep the web tier on the ordinary GIL build, because that tier is the one holding psycopg. Put free-threading where the dependency graph is already green.&lt;/p&gt;

&lt;p&gt;The case that paid off for that client was a nightly ingest job: pull a few thousand rows out of Postgres once, hand the parsing and numeric work to a thread pool, write back once. The DB touch is serial and happens on the normal interpreter; the CPU-bound middle runs under 3.14t with NumPy, which has shipped free-threaded support since 2.1.0 per &lt;a href="https://py-free-threading.github.io/tracking/" rel="noopener noreferrer"&gt;the tracker&lt;/a&gt;. Two processes, one boundary, no gamble on the driver.&lt;/p&gt;

&lt;p&gt;Getting the interpreter is the easy part. The &lt;a href="https://py-free-threading.github.io/installing-cpython/" rel="noopener noreferrer"&gt;installation guide&lt;/a&gt; documents &lt;code&gt;uv venv --python 3.14t&lt;/code&gt;, &lt;code&gt;brew install python-freethreading&lt;/code&gt;, and &lt;code&gt;python3.14t&lt;/code&gt; as the executable name; the manylinux images ship &lt;code&gt;python3.14t&lt;/code&gt; too, which is what I used in the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; quay.io/pypa/manylinux_2_28_x86_64 AS crunch
&lt;span class="k"&gt;RUN&lt;/span&gt; python3.14t -m venv /opt/venv
&lt;span class="k"&gt;ENV&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;"/opt/venv/bin:$PATH"&lt;/span&gt;
&lt;span class="c"&gt;# numpy has shipped free-threaded wheels since 2.1.0; psycopg has not&lt;/span&gt;
&lt;span class="k"&gt;RUN&lt;/span&gt; pip install --no-cache-dir &lt;span class="s2"&gt;"numpy&amp;gt;=2.1"&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt; crunch/ /app/crunch/
&lt;span class="c"&gt;# fail loudly rather than silently running with the GIL back on&lt;/span&gt;
&lt;span class="k"&gt;RUN&lt;/span&gt; python -c &lt;span class="s2"&gt;"import sys, numpy; assert not sys._is_gil_enabled(), 'GIL re-enabled'"&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"python"&lt;/span&gt;, &lt;span class="s2"&gt;"/app/crunch/run.py"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the assertion in the build, not just at runtime. The whole risk of this build is that it looks fine while quietly doing nothing for you.&lt;/p&gt;

&lt;p&gt;The thing to watch is not Django. It is &lt;a href="https://github.com/psycopg/psycopg/issues/1095" rel="noopener noreferrer"&gt;psycopg #1095&lt;/a&gt; and whether binary wheels tagged &lt;code&gt;cp314t&lt;/code&gt; appear on PyPI. The day they do, re-run your own benchmark on your own query mix — not a hello-world view — and compare against &lt;code&gt;gunicorn --threads&lt;/code&gt; on the GIL build. Until then, a free-threaded Django web tier is a science project, and the honest version of "can we get more out of this box" is still: fix the N+1s, add the index, and move the CPU work out of the request.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.python.org/3/howto/free-threading-python.html" rel="noopener noreferrer"&gt;Python HOWTO: Free-threaded CPython&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://peps.python.org/pep-0779/" rel="noopener noreferrer"&gt;PEP 779 – Criteria for supported status for free-threaded Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forum.djangoproject.com/t/improve-free-threading-performance/44497" rel="noopener noreferrer"&gt;Django forum: Improve free-threading performance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.djangoproject.com/ticket/36983" rel="noopener noreferrer"&gt;Django ticket #36983&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/django/django/pull/21623" rel="noopener noreferrer"&gt;Django PR #21623 — asgiref 3.12 and free-threading CI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/django/django/blob/main/pyproject.toml" rel="noopener noreferrer"&gt;Django &lt;code&gt;pyproject.toml&lt;/code&gt; on main&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/psycopg/psycopg/issues/1095" rel="noopener noreferrer"&gt;psycopg issue #1095 — Support free-threaded python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://py-free-threading.github.io/tracking/" rel="noopener noreferrer"&gt;py-free-threading compatibility tracking&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://py-free-threading.github.io/installing-cpython/" rel="noopener noreferrer"&gt;Installing a free-threaded CPython&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/dev/faq/install/" rel="noopener noreferrer"&gt;Django FAQ: What Python version can I use with Django?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/stable/ref/databases/" rel="noopener noreferrer"&gt;Django docs: PostgreSQL notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://devguide.python.org/versions/" rel="noopener noreferrer"&gt;CPython developer guide: status of Python versions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/should-you-run-django-on-free-threaded-python/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>django</category>
      <category>performance</category>
      <category>python</category>
    </item>
    <item>
      <title>Django 6.1 Fetch Modes: The N+1 Fix With a Catch</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Sun, 15 Nov 2026 10:00:09 +0000</pubDate>
      <link>https://dev.to/papansarkar101/django-61-fetch-modes-the-n1-fix-with-a-catch-5742</link>
      <guid>https://dev.to/papansarkar101/django-61-fetch-modes-the-n1-fix-with-a-catch-5742</guid>
      <description>&lt;p&gt;The endpoint was a DRF list view on a fleet-compliance API: drivers, each with a carrier and a most-recent inspection, three serializer levels deep. Django Debug Toolbar showed a few hundred queries for one page of results. Nothing was broken. The &lt;code&gt;select_related()&lt;/code&gt; chain in the viewset had simply stopped matching the fields the serializer touched, which is where every serializer older than about a year ends up — the query lives in the view, the field access lives in the serializer, and no part of Django connects the two.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/" rel="noopener noreferrer"&gt;Django 6.1, released on 5 August 2026&lt;/a&gt;, ships a feature aimed squarely at that gap. Fetch modes let you tell a queryset what to do when something later asks for a field the query didn't load. The release announcement leads with it: &lt;a href="https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/" rel="noopener noreferrer"&gt;"Model field fetch modes for configuring on-demand fetching behavior"&lt;/a&gt;. I've now put it into two client codebases, and it does roughly what it says — with one boundary that is easy to miss and will make you think it doesn't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the default has always been
&lt;/h2&gt;

&lt;p&gt;Take the canonical pair:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TextField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;book&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without &lt;code&gt;select_related("author")&lt;/code&gt;, that loop runs one query for the books and one more per book for its author. The &lt;a href="https://docs.djangoproject.com/en/6.1/topics/db/fetch-modes/" rel="noopener noreferrer"&gt;fetch modes guide&lt;/a&gt; names this behaviour &lt;code&gt;FETCH_ONE&lt;/code&gt; and documents it as the default: it "fetches the missing field for the current instance only." The guide is blunt about the result — 1 query for the books plus N for the authors, the N+1 problem, in the framework's own words.&lt;/p&gt;

&lt;p&gt;What's new is that this is now a &lt;em&gt;named, swappable&lt;/em&gt; policy instead of an unwritten law of the ORM.&lt;/p&gt;

&lt;h2&gt;
  
  
  FETCH_PEERS, and the two-query claim
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="n"&gt;books&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FETCH_PEERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;book&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;books&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;book&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/models/querysets/" rel="noopener noreferrer"&gt;&lt;code&gt;QuerySet.fetch_mode()&lt;/code&gt;&lt;/a&gt; sets the mode for every instance the queryset produces. Under &lt;code&gt;FETCH_PEERS&lt;/code&gt;, the first &lt;code&gt;book.author&lt;/code&gt; access doesn't fetch one author — it fetches the author for that instance &lt;em&gt;and for every other instance that came out of the same queryset&lt;/em&gt;. The guide puts the reasoning plainly: the mode assumes "that if you need a field for one instance, you probably need it for all instances in the same batch, since you'll likely process them all identically." Query count for the loop above: &lt;a href="https://docs.djangoproject.com/en/6.1/topics/db/fetch-modes/" rel="noopener noreferrer"&gt;1 for the books, 1 for the authors&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Two details matter more than the headline.&lt;/p&gt;

&lt;p&gt;First, the mode propagates. Django copies an instance's fetch mode onto any related object it fetches, so &lt;a href="https://docs.djangoproject.com/en/6.1/topics/db/fetch-modes/" rel="noopener noreferrer"&gt;"the mode applies to a whole tree of relationships, not just the top-level model in the initial QuerySet"&lt;/a&gt;. This is the part that actually fixed my serializer. I did not have to predict the traversal depth; &lt;code&gt;Driver.objects.fetch_mode(models.FETCH_PEERS)&lt;/code&gt; at the viewset covered the carrier two levels down because the carrier instances inherited the mode on the way through.&lt;/p&gt;

&lt;p&gt;Second, peers are held as weak references. The guide notes they're tracked "in a list of weak references, which avoids memory leaks when some peers are discarded." That's the difference between this and keeping the whole batch pinned in memory, and it's why I'd use it on a paginated list view without worrying much.&lt;/p&gt;

&lt;p&gt;You can make it the default for a model with a manager, which is what I ended up doing for the two read-heavy models rather than touching every call site:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;DriverManager&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Manager&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_queryset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_queryset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FETCH_PEERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Driver&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;carrier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Carrier"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;objects&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DriverManager&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The relation it does not cover
&lt;/h2&gt;

&lt;p&gt;Here is the boundary. The guide lists exactly what fetch modes apply to: &lt;code&gt;ForeignKey&lt;/code&gt; fields, &lt;code&gt;OneToOneField&lt;/code&gt; fields and their reverse accessors, fields deferred by &lt;code&gt;defer()&lt;/code&gt; or &lt;code&gt;only()&lt;/code&gt;, and generic relations.&lt;/p&gt;

&lt;p&gt;Reverse foreign keys and many-to-many are not on that list. They go through related managers, and the same guide says the mode is copied into related managers &lt;a href="https://docs.djangoproject.com/en/6.1/topics/db/fetch-modes/" rel="noopener noreferrer"&gt;"even though fetch modes don't affect such managers' queries"&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So this loop is still N+1 under &lt;code&gt;FETCH_PEERS&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;authors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FETCH_PEERS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;author&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;authors&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;author&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;book_set&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="c1"&gt;# still one query per author&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The practical reading: &lt;code&gt;FETCH_PEERS&lt;/code&gt; is an on-demand replacement for the &lt;code&gt;select_related()&lt;/code&gt; you forgot, not for &lt;code&gt;prefetch_related()&lt;/code&gt;. Forward and one-to-one relations get automatic; collections still need you to ask. On the compliance API, that split was clean — drivers → carrier was forward (fixed by the mode), drivers → inspections was reverse (still an explicit &lt;code&gt;prefetch_related&lt;/code&gt;). If you switch the mode on, see the query count halve, and conclude it's unreliable, this is almost certainly why.&lt;/p&gt;

&lt;h2&gt;
  
  
  FETCH_RAISE, and where I actually get value
&lt;/h2&gt;

&lt;p&gt;The third mode is the one I expect to keep longest. &lt;code&gt;FETCH_RAISE&lt;/code&gt; makes any on-demand fetch an error rather than a query: it raises &lt;a href="https://docs.djangoproject.com/en/6.1/ref/exceptions/" rel="noopener noreferrer"&gt;&lt;code&gt;FieldFetchBlocked&lt;/code&gt;&lt;/a&gt;, new in this release and documented in &lt;code&gt;django.core.exceptions&lt;/code&gt; as "raised when a field would be fetched on-demand and the &lt;code&gt;FETCH_RAISE&lt;/code&gt; fetch mode is active."&lt;/p&gt;

&lt;p&gt;This is a regression test, not a runtime strategy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exceptions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;FieldFetchBlocked&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;test_driver_list_does_not_lazy_load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;qs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Driver&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select_related&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"carrier"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fetch_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;FETCH_RAISE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DriverSerializer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;qs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;many&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="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;   &lt;span class="c1"&gt;# raises if select_related drifts&lt;/span&gt;
    &lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assertEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The point is that the test fails the day someone adds &lt;code&gt;carrier.region.name&lt;/code&gt; to the serializer without touching the viewset. That is the exact failure mode I started this post with, and until now catching it meant either counting queries with &lt;code&gt;assertNumQueries&lt;/code&gt; — which tells you &lt;em&gt;that&lt;/em&gt; something changed, not &lt;em&gt;where&lt;/em&gt; — or reaching for a third-party library.&lt;/p&gt;

&lt;p&gt;Those libraries are still worth knowing, and they're not obsolete. &lt;a href="https://github.com/dabapps/django-zen-queries" rel="noopener noreferrer"&gt;&lt;code&gt;django-zen-queries&lt;/code&gt;&lt;/a&gt; does something adjacent but broader: &lt;code&gt;queries_disabled&lt;/code&gt; as a context manager or decorator blocks &lt;em&gt;all&lt;/em&gt; queries in a block and raises &lt;code&gt;QueriesDisabledError&lt;/code&gt;, with escape hatches (&lt;code&gt;queries_dangerously_enabled&lt;/code&gt;), a &lt;code&gt;render&lt;/code&gt; replacement that disables queries during template rendering, and DRF mixins. &lt;code&gt;FETCH_RAISE&lt;/code&gt; only blocks on-demand field fetches on instances from a given queryset. If you want "nothing in this template may touch the database", the library still wins. If you want "this serializer must not discover a relation I didn't load", the built-in is narrower and needs no dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I'd actually do on an existing codebase
&lt;/h2&gt;

&lt;p&gt;The honest cost-benefit, having done it twice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Don't rewrite your &lt;code&gt;select_related()&lt;/code&gt; calls.&lt;/strong&gt; An explicit join is still one query where &lt;code&gt;FETCH_PEERS&lt;/code&gt; is two, and the explicit version documents intent at the point of the query. Leave the ones that work.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add &lt;code&gt;FETCH_PEERS&lt;/code&gt; as a safety net on read paths that fan out&lt;/strong&gt; — list serializers, admin changelists, anything where the traversal isn't visible from the queryset. It turns the worst case from linear to constant without you predicting the shape.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add &lt;code&gt;FETCH_RAISE&lt;/code&gt; to the tests for those same paths.&lt;/strong&gt; This is the piece that stops the drift coming back.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check your floor before planning any of it.&lt;/strong&gt; &lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;Django 6.1 supports Python 3.12, 3.13 and 3.14&lt;/a&gt;, and it drops PostgreSQL 14, MySQL below 8.4 and MariaDB below 10.11. On a client project, the database floor is usually the thing that decides the timeline, not the feature you wanted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One scheduling note that caught me out. Django 6.1 is not an LTS release — &lt;a href="https://www.djangoproject.com/download/" rel="noopener noreferrer"&gt;5.2 LTS is the current long-term-support series, with extended support into April 2028&lt;/a&gt;, while 6.1's own mainstream support ends well before that. If you're on 5.2 LTS for a client who pays for stability, fetch modes are a reason to plan the jump, not a reason to make it this quarter.&lt;/p&gt;

&lt;p&gt;The broader thing I take from this release is a change in where the N+1 problem is &lt;em&gt;allowed to live&lt;/em&gt;. For a decade the fix has been "name every relation you'll touch, at the top, before you know what you'll touch." Fetch modes move part of that decision to the moment of access, where the information actually is. The catch is that it moved only part of it — forward relations, not collections — and the release notes don't put a box around that. The guide does, in one clause, and it's the clause worth reading twice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;Django 6.1 release notes&lt;/a&gt; — Python support, dropped database versions, feature list&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.djangoproject.com/en/6.1/topics/db/fetch-modes/" rel="noopener noreferrer"&gt;Fetch modes topic guide&lt;/a&gt; — &lt;code&gt;FETCH_ONE&lt;/code&gt;, &lt;code&gt;FETCH_PEERS&lt;/code&gt;, &lt;code&gt;FETCH_RAISE&lt;/code&gt;, propagation and applicability&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/models/querysets/" rel="noopener noreferrer"&gt;&lt;code&gt;QuerySet.fetch_mode()&lt;/code&gt; reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/exceptions/" rel="noopener noreferrer"&gt;&lt;code&gt;FieldFetchBlocked&lt;/code&gt; in Django core exceptions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/" rel="noopener noreferrer"&gt;Django 6.1 release announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.djangoproject.com/download/" rel="noopener noreferrer"&gt;Django supported versions and support dates&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/dabapps/django-zen-queries" rel="noopener noreferrer"&gt;django-zen-queries&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/django-6-1-fetch-modes-n-plus-one/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>django</category>
      <category>performance</category>
      <category>python</category>
    </item>
    <item>
      <title>Django's Built-In CSP: What 6.0 Shipped and 6.1 Fixed</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Sat, 14 Nov 2026 08:30:06 +0000</pubDate>
      <link>https://dev.to/papansarkar101/djangos-built-in-csp-what-60-shipped-and-61-fixed-451h</link>
      <guid>https://dev.to/papansarkar101/djangos-built-in-csp-what-60-shipped-and-61-fixed-451h</guid>
      <description>&lt;p&gt;The admin login page came up with no styling and no JavaScript. The console was a wall of &lt;code&gt;Refused to load the script&lt;/code&gt; errors, every one of them pointing at something under &lt;code&gt;/static/admin/js/&lt;/code&gt;. An hour earlier I had added nine lines to &lt;code&gt;settings.py&lt;/code&gt; on a Django 6.0 project to turn on a nonce-based Content Security Policy. The policy was fine. The admin templates were the problem, and that turned out to be a known bug rather than my mistake.&lt;/p&gt;

&lt;p&gt;If you are adopting the CSP support Django now ships in core, that is the shape of the first afternoon. The settings are genuinely simple. The surprises are all in what a strict policy does to code you did not write — the admin, your form widgets, your cache layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  What 6.0 actually moved into core
&lt;/h2&gt;

&lt;p&gt;Before 6.0 this was third-party territory. &lt;a href="https://docs.djangoproject.com/en/6.0/releases/6.0/" rel="noopener noreferrer"&gt;Django 6.0's release notes&lt;/a&gt; list Content Security Policy support as a headline feature, and the pieces are small enough to summarise in full:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;django.middleware.csp.ContentSecurityPolicyMiddleware&lt;/code&gt;, which builds the header on each response.&lt;/li&gt;
&lt;li&gt;Two settings, &lt;code&gt;SECURE_CSP&lt;/code&gt; and &lt;code&gt;SECURE_CSP_REPORT_ONLY&lt;/code&gt;, both of which take plain Python dictionaries.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;CSP&lt;/code&gt; enum in &lt;code&gt;django.utils.csp&lt;/code&gt; holding the quoted keywords, so you never hand-write &lt;code&gt;'self'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;django.template.context_processors.csp&lt;/code&gt; context processor, which exposes the per-request nonce to templates.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;csp_override&lt;/code&gt; and &lt;code&gt;csp_report_only_override&lt;/code&gt; decorators in &lt;code&gt;django.views.decorators.csp&lt;/code&gt; for per-view policies, documented in the &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;CSP reference&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The config is a dictionary of directive names to lists of sources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# settings.py&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csp&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;CSP&lt;/span&gt;

&lt;span class="no"&gt;MIDDLEWARE&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="c1"&gt;# ...&lt;/span&gt;
    &lt;span class="s2"&gt;"django.middleware.csp.ContentSecurityPolicyMiddleware"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="no"&gt;SECURE_CSP&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"default-src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;CSP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SELF&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"script-src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;CSP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SELF&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;CSP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NONCE&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"img-src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;CSP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SELF&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"https:"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That produces &lt;code&gt;default-src 'self'; script-src 'self' 'nonce-SECRET'; img-src 'self' https:&lt;/code&gt;. The enum covers the keywords you actually reach for — &lt;code&gt;NONE&lt;/code&gt;, &lt;code&gt;SELF&lt;/code&gt;, &lt;code&gt;STRICT_DYNAMIC&lt;/code&gt;, &lt;code&gt;UNSAFE_INLINE&lt;/code&gt;, &lt;code&gt;UNSAFE_EVAL&lt;/code&gt;, &lt;code&gt;UNSAFE_HASHES&lt;/code&gt;, &lt;code&gt;WASM_UNSAFE_EVAL&lt;/code&gt;, &lt;code&gt;REPORT_SAMPLE&lt;/code&gt; and &lt;code&gt;NONCE&lt;/code&gt; — and the reference page is explicit that the two settings &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;can be used independently or together&lt;/a&gt;, which is the detail the rollout below depends on.&lt;/p&gt;

&lt;p&gt;One thing the dictionary shape does not give you is merging. More on that further down, because it bit me.&lt;/p&gt;

&lt;h2&gt;
  
  
  The nonce is the whole game
&lt;/h2&gt;

&lt;p&gt;A policy of &lt;code&gt;default-src 'self'&lt;/code&gt; is easy and nearly useless on a real app, because real apps have inline &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; blocks — analytics snippets, a CSRF-aware fetch helper, the one &lt;code&gt;window.__INITIAL_STATE__&lt;/code&gt; dump someone added in 2023. The moment you drop &lt;code&gt;'unsafe-inline'&lt;/code&gt;, those stop running.&lt;/p&gt;

&lt;p&gt;Nonces are the way out. You put &lt;code&gt;CSP.NONCE&lt;/code&gt; in &lt;code&gt;script-src&lt;/code&gt;, enable the context processor, and tag your inline elements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;nonce&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{{ csp_nonce }}"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"#filters"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hidden&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;
&lt;span class="nt"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two mechanics here are worth knowing before you debug anything. First, generation is lazy: the &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;CSP reference&lt;/a&gt; says a nonce is created only if &lt;code&gt;{{ csp_nonce }}&lt;/code&gt; is actually accessed during rendering. Second, the inverse failure is silent-ish — if a template emits &lt;code&gt;{{ csp_nonce }}&lt;/code&gt; but your policy has no &lt;code&gt;NONCE&lt;/code&gt; in the matching directive, the browser just blocks the element.&lt;/p&gt;

&lt;p&gt;If you want the stricter setup, &lt;code&gt;CSP.STRICT_DYNAMIC&lt;/code&gt; lets a nonced script load further scripts without you allowlisting every CDN. The trade-off is that it changes how the rest of the directive is read: MDN notes that with &lt;code&gt;'strict-dynamic'&lt;/code&gt; present, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/script-src" rel="noopener noreferrer"&gt;any allowlist or source expressions such as &lt;code&gt;'self'&lt;/code&gt; or &lt;code&gt;'unsafe-inline'&lt;/code&gt; will be ignored&lt;/a&gt;. People add &lt;code&gt;'strict-dynamic'&lt;/code&gt; to an existing allowlist, see nothing break in their own code, and conclude the allowlist is still doing work. It is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  The admin was the first thing to break
&lt;/h2&gt;

&lt;p&gt;This is the part I lost an afternoon to. With a nonce-based policy on Django 6.0, the admin's own &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; tags carry no nonce, so the browser blocks them and the admin renders as unstyled HTML. It is &lt;a href="https://code.djangoproject.com/ticket/36825" rel="noopener noreferrer"&gt;ticket #36825, "CSP nonces are not applied in the Django admin"&lt;/a&gt;, filed against 6.0, now closed as fixed — the fix extended the admin, error page and registration templates so the nonce is included when one is available.&lt;/p&gt;

&lt;p&gt;That fix is in 6.1, and it is buried in the minor features. The &lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;6.1 release notes&lt;/a&gt; state that CSP nonce attributes are now added on &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;style&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; elements in admin templates and all built-in templates when the &lt;code&gt;csp()&lt;/code&gt; context processor is configured. So the practical advice is blunt: if you are putting a nonce policy in front of the Django admin, do the 6.1 upgrade first. On 6.0 your options are forking admin templates or weakening the policy for admin URLs, and both are worse than an upgrade you were going to do anyway.&lt;/p&gt;

&lt;p&gt;Django 6.1, &lt;a href="https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/" rel="noopener noreferrer"&gt;released on 5 August 2026&lt;/a&gt;, adds two more things that only matter once you are actually using nonces.&lt;/p&gt;

&lt;p&gt;The first is a template tag for external assets. &lt;code&gt;{{ csp_nonce }}&lt;/code&gt; works for inline blocks, but a &lt;code&gt;&amp;lt;script src="..."&amp;gt;&lt;/code&gt; needs the attribute rendered on the element, and the &lt;a href="https://docs.djangoproject.com/en/6.1/ref/csp/" rel="noopener noreferrer"&gt;6.1 CSP reference&lt;/a&gt; documents &lt;code&gt;csp_nonce_attr&lt;/code&gt; for exactly that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;script&lt;/span&gt; &lt;span class="na"&gt;src&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{% static 'app/filters.js' %}"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;%&lt;/span&gt; &lt;span class="na"&gt;csp_nonce_attr&lt;/span&gt; &lt;span class="na"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;link&lt;/span&gt; &lt;span class="na"&gt;rel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"stylesheet"&lt;/span&gt; &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"{% static 'app/filters.css' %}"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;%&lt;/span&gt; &lt;span class="na"&gt;csp_nonce_attr&lt;/span&gt; &lt;span class="na"&gt;%&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It also takes a &lt;code&gt;Media&lt;/code&gt; object, which is the fix for form widget assets you do not control the markup of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;{% csp_nonce_attr form.media %}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second is a system check that catches the exact misconfiguration described above. From the &lt;a href="https://docs.djangoproject.com/en/6.1/ref/checks/" rel="noopener noreferrer"&gt;checks reference&lt;/a&gt;, &lt;code&gt;security.W027&lt;/code&gt; fires when "Your Content Security Policy includes &lt;code&gt;CSP.NONCE&lt;/code&gt; and &lt;code&gt;ContentSecurityPolicyMiddleware&lt;/code&gt; is enabled, but &lt;code&gt;django.template.context_processors.csp&lt;/code&gt; is not configured." There is also &lt;code&gt;security.E026&lt;/code&gt;, which errors if a CSP setting is not a dictionary. Run &lt;code&gt;manage.py check --deploy&lt;/code&gt; after you edit the policy; it is cheaper than reading a console.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things that cost me time
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Per-view overrides replace, they do not merge.&lt;/strong&gt; This reads like a convenience decorator and behaves like a full swap. The &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;reference&lt;/a&gt; is clear that overrides fully replace the base policy, and an empty mapping removes the header entirely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utils&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csp&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="no"&gt;CSP&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;views&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decorators&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;csp&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;csp_override&lt;/span&gt;

&lt;span class="c1"&gt;# This view now has NO default-src, NO script-src. Only img-src.&lt;/span&gt;
&lt;span class="nd"&gt;@csp_override&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"img-src"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="no"&gt;CSP&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;SELF&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"data:"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;chart_png&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I wrote something very close to that to allow &lt;code&gt;data:&lt;/code&gt; images on one endpoint and quietly removed every other directive from it. Build overrides from your base dict instead of writing them fresh.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A cached page serves a dead nonce.&lt;/strong&gt; Whole-response caching and nonces do not mix: the &lt;a href="https://docs.djangoproject.com/en/6.1/ref/csp/" rel="noopener noreferrer"&gt;6.1 reference&lt;/a&gt; warns that caching full responses can reuse a nonce across users and requests, and notes it will look like it works, because the cached HTML and the cached header still match each other. It defeats the point of the nonce, which is that it is unpredictable per request. If a view must be cached at the response level, get the inline script out of it rather than getting clever.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nobody is collecting your reports.&lt;/strong&gt; &lt;code&gt;report-uri&lt;/code&gt; in the policy makes browsers send violation reports somewhere, and the &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;CSP reference&lt;/a&gt; states plainly that Django does not receive, store or process them — you provide the endpoint or a third-party service. A report-only rollout with no endpoint wired up is a policy nobody is reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you already run django-csp
&lt;/h2&gt;

&lt;p&gt;For years the answer here was Mozilla's &lt;code&gt;django-csp&lt;/code&gt;. Its &lt;a href="https://pypi.org/project/django-csp/" rel="noopener noreferrer"&gt;PyPI page&lt;/a&gt; lists version 4.0 from 2 April 2025, maintained by the Mozilla MEAO team, with framework classifiers covering Django 4.2 through 5.2 and no mention of the core support.&lt;/p&gt;

&lt;p&gt;I would not rip it out mid-sprint. One detail makes coexistence survivable: the core middleware builds its headers unless another layer has already set them, per the &lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;CSP reference&lt;/a&gt;. So the package keeps winning while it is installed, and you can move at your own pace. On anything new on 6.x I use core and skip the dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rollout order that worked
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Upgrade to 6.1 first if the Django admin is in scope. Everything else is downstream of that.&lt;/li&gt;
&lt;li&gt;Add the middleware and &lt;code&gt;SECURE_CSP_REPORT_ONLY&lt;/code&gt; with &lt;code&gt;default-src 'self'&lt;/code&gt; and a &lt;code&gt;report-uri&lt;/code&gt; you have actually built. Enforce nothing yet.&lt;/li&gt;
&lt;li&gt;Read the reports for a full week, including a weekend. Admin-heavy traffic and marketing-script traffic do not show up on the same days.&lt;/li&gt;
&lt;li&gt;Add the context processor, then put nonces on your inline blocks and &lt;code&gt;{% csp_nonce_attr %}&lt;/code&gt; on your external ones. Run &lt;code&gt;check --deploy&lt;/code&gt; and clear &lt;code&gt;security.W027&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Promote the policy from &lt;code&gt;SECURE_CSP_REPORT_ONLY&lt;/code&gt; to &lt;code&gt;SECURE_CSP&lt;/code&gt;, and keep report-only alive for the next change you want to trial. Both settings running at once is the supported way to test a tightening without shipping it.&lt;/li&gt;
&lt;li&gt;Only then consider &lt;code&gt;strict-dynamic&lt;/code&gt;, and when you do, delete the allowlist it has just made inert instead of leaving it there to mislead the next person.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The thing worth internalising is that CSP in core did not make CSP easy. It removed a dependency and gave you a dictionary. The work is still the inventory of every inline script and third-party asset your app actually loads, and the only honest way to get that list is a week of report-only traffic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.0/releases/6.0/" rel="noopener noreferrer"&gt;Django 6.0 release notes — Content Security Policy support&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.0/ref/csp/" rel="noopener noreferrer"&gt;Django 6.0 CSP reference: settings, decorators, nonce and caching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.0/howto/csp/" rel="noopener noreferrer"&gt;Django how-to: use Django's Content Security Policy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.djangoproject.com/ticket/36825" rel="noopener noreferrer"&gt;Django ticket #36825 — CSP nonces are not applied in the Django admin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;Django 6.1 release notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/csp/" rel="noopener noreferrer"&gt;Django 6.1 CSP reference — csp_nonce_attr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/checks/" rel="noopener noreferrer"&gt;Django system check reference — security.W027 and security.E026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.djangoproject.com/weblog/2026/aug/05/django-61-released/" rel="noopener noreferrer"&gt;Django 6.1 released — weblog announcement&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Content-Security-Policy/script-src" rel="noopener noreferrer"&gt;MDN — CSP script-src directive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/django-csp/" rel="noopener noreferrer"&gt;django-csp on PyPI&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/django-csp-built-in-6-0-6-1/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>django</category>
      <category>python</category>
      <category>security</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Django's Tasks API Ships Without a Worker</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Fri, 13 Nov 2026 16:00:25 +0000</pubDate>
      <link>https://dev.to/papansarkar101/djangos-tasks-api-ships-without-a-worker-je8</link>
      <guid>https://dev.to/papansarkar101/djangos-tasks-api-ships-without-a-worker-je8</guid>
      <description>&lt;p&gt;Halfway through a Django 6.0 upgrade on a client's compliance SaaS, I opened a branch called &lt;code&gt;kill-celery&lt;/code&gt;. The plan was two hours of work: swap every &lt;code&gt;@shared_task&lt;/code&gt; for the new built-in &lt;code&gt;@task&lt;/code&gt;, drop the broker, delete the worker service, ship a smaller stack. I got as far as pasting a &lt;code&gt;TASKS&lt;/code&gt; block into settings before I hit the sentence that closed the branch. Django's Tasks framework, in its own words, &lt;a href="https://docs.djangoproject.com/en/6.1/topics/tasks/" rel="noopener noreferrer"&gt;"does not provide a worker mechanism to run Tasks"&lt;/a&gt; — execution "must be handled by infrastructure outside Django, such as a separate process or service."&lt;/p&gt;

&lt;p&gt;That is not a rough edge to be smoothed over in a point release. It is the declared scope of the feature, and it is the part most upgrade write-ups skip past on their way to the code sample.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually shipped
&lt;/h2&gt;

&lt;p&gt;Django 6.0 &lt;a href="https://www.djangoproject.com/weblog/2025/dec/03/django-60-released/" rel="noopener noreferrer"&gt;arrived on December 3, 2025&lt;/a&gt; with an API that standardises how background work is &lt;em&gt;declared&lt;/em&gt; and &lt;em&gt;enqueued&lt;/em&gt;, not how it is executed. You decorate a function, call &lt;code&gt;.enqueue()&lt;/code&gt;, and get a &lt;code&gt;TaskResult&lt;/code&gt; back:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# billing/tasks.py&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;core&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mail&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;send_mail&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tasks&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;


&lt;span class="nd"&gt;@task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;queue_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"emails"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;priority&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;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;email_users&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;subject&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;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;send_mail&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subject&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; &lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;emails&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# settings.py&lt;/span&gt;
&lt;span class="no"&gt;TASKS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="s2"&gt;"BACKEND"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"django.tasks.backends.immediate.ImmediateBackend"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"QUEUES"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"default"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"emails"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two backends come in the box: &lt;code&gt;ImmediateBackend&lt;/code&gt;, which runs the function inline the moment you enqueue it, and &lt;code&gt;DummyBackend&lt;/code&gt;, which stores the result and never runs anything. &lt;a href="https://docs.djangoproject.com/en/6.1/ref/tasks/" rel="noopener noreferrer"&gt;The reference docs mark both as development and testing tools&lt;/a&gt; and say production systems should rely on backends that supply a worker process and a durable queue.&lt;/p&gt;

&lt;p&gt;So the shape of the feature is: Django owns the interface, somebody else owns the execution. That is the same arrangement as &lt;code&gt;DATABASES&lt;/code&gt;, &lt;code&gt;CACHES&lt;/code&gt; and the storage API, and it is exactly what &lt;a href="https://www.djangoproject.com/weblog/2024/may/29/django-enhancement-proposal-14-background-workers/" rel="noopener noreferrer"&gt;DEP 14, written by Jake Howard&lt;/a&gt;, set out to do — "provide an interface and base implementation for long-running background tasks in Django". The interface &lt;a href="https://github.com/django/django/pull/18627" rel="noopener noreferrer"&gt;landed in core in September 2025&lt;/a&gt; and shipped in 6.0.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that is not there
&lt;/h2&gt;

&lt;p&gt;Read the API surface as a list of what a production queue needs, and the gaps are obvious. There is no worker. There is no retry policy — a task that raises has its exception and traceback recorded in &lt;code&gt;TaskResult.errors&lt;/code&gt; and stops there. There is no periodic scheduling, no dead-letter queue, no concurrency controls, no durable storage at all unless the backend you pick provides it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;run_after&lt;/code&gt; exists on the task object and takes a &lt;code&gt;timedelta&lt;/code&gt; or a timezone-aware &lt;code&gt;datetime&lt;/code&gt;, and backends advertise whether they honour it through capability flags like &lt;code&gt;supports_defer&lt;/code&gt;, &lt;code&gt;supports_priority&lt;/code&gt; and &lt;code&gt;supports_get_result&lt;/code&gt;. A one-shot delay is genuinely useful, but it is not a cron replacement, and a flag that tells you a backend &lt;em&gt;cannot&lt;/em&gt; defer is not a scheduler. One review of the framework put it as &lt;a href="https://www.loopwerk.io/articles/2026/django-tasks-review/" rel="noopener noreferrer"&gt;"not a queue, not a worker system, and not a scheduler"&lt;/a&gt;, which reads as harsh until you check it against the reference page and find it accurate.&lt;/p&gt;

&lt;p&gt;If you were waiting for the next release to close the gap, it did not. &lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;Django 6.1&lt;/a&gt; gave the &lt;code&gt;task()&lt;/code&gt; decorator a &lt;code&gt;**kwargs&lt;/code&gt; passthrough to the backend's task class and made &lt;code&gt;Task&lt;/code&gt; and &lt;code&gt;TaskResult&lt;/code&gt; picklable. No database backend, no worker command, no retries. The same release is where the interesting work went elsewhere: model field fetch modes, database-level &lt;code&gt;on_delete&lt;/code&gt; options, and the dictionary-based &lt;code&gt;MAILERS&lt;/code&gt; setting that deprecates the whole &lt;code&gt;EMAIL_*&lt;/code&gt; family.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I put behind the interface
&lt;/h2&gt;

&lt;p&gt;Three options are worth considering, and the choice is mostly about what infrastructure you are already paying for.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A database backend, for small services.&lt;/strong&gt; &lt;code&gt;django_tasks_db.DatabaseBackend&lt;/code&gt; stores tasks in your existing database and ships a &lt;code&gt;db_worker&lt;/code&gt; management command that processes them, plus a &lt;code&gt;prune_db_task_results&lt;/code&gt; command for housekeeping — &lt;a href="https://github.com/RealOrangeOne/django-tasks-db" rel="noopener noreferrer"&gt;it lives in a separate package outside Django core&lt;/a&gt;. One team running it in production &lt;a href="https://www.better-simple.com/django/2026/05/06/using-django-tasks-in-production/" rel="noopener noreferrer"&gt;points at the operational win&lt;/a&gt;: because the queue is ORM rows, scheduled, completed and errored tasks are all visible in the Django admin without adding a monitoring stack. For a service that sends transactional email and runs the occasional long export, that is the whole requirement, and it removes Redis from the deployment diagram entirely.&lt;/p&gt;

&lt;p&gt;The trade is durability and throughput. Every enqueue is a write and every poll is a query against the same database serving your web requests, so a task volume that would be trivial for a broker becomes contention for your connection pool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Celery, when you already run a broker.&lt;/strong&gt; If the project has Redis or RabbitMQ up for other reasons, the queue is already paid for, and Celery brings retries with backoff, beat scheduling, routing, rate limits and chords — none of which the Django interface will grow soon. Migrating to &lt;code&gt;django.tasks&lt;/code&gt; here buys you a slightly nicer decorator and costs you all of that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RQ, in the middle.&lt;/strong&gt; Redis-backed, far less machinery than Celery, and a reasonable landing spot for a service that has outgrown database polling but does not need workflow primitives.&lt;/p&gt;

&lt;p&gt;What I ended up doing on the compliance SaaS: kept Celery for the FMCSA sync jobs that need retries and a schedule, and moved two fire-and-forget email paths to &lt;code&gt;django.tasks&lt;/code&gt; behind the database backend. The &lt;code&gt;kill-celery&lt;/code&gt; branch became &lt;code&gt;narrow-celery&lt;/code&gt;, which is a less satisfying name and a much smaller diff.&lt;/p&gt;

&lt;h2&gt;
  
  
  The transaction trap, which is now yours to handle
&lt;/h2&gt;

&lt;p&gt;This is the failure mode I have debugged on three separate projects, and the new API does not save you from it. Enqueue a task inside &lt;code&gt;transaction.atomic()&lt;/code&gt; and the worker — running in a different process, on a different connection — can pick the job up before your transaction commits and fail to find the row it was told to process. &lt;a href="https://docs.djangoproject.com/en/6.1/topics/tasks/" rel="noopener noreferrer"&gt;The Tasks docs are explicit about it&lt;/a&gt; and prescribe the standard fix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;functools&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;partial&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt;

&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;billing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tasks&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;generate_invoice_pdf&lt;/span&gt;


&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;close_period&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;atomic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;invoice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;objects&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;period&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"period"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;transaction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on_commit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;partial&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;generate_invoice_pdf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;enqueue&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;invoice_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;invoice&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;pk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the &lt;code&gt;partial&lt;/code&gt;. &lt;code&gt;on_commit&lt;/code&gt; takes a callable with no arguments, so the common bug is calling &lt;code&gt;.enqueue(...)&lt;/code&gt; immediately and handing &lt;code&gt;on_commit&lt;/code&gt; the result. Celery users get a shortcut here instead: &lt;a href="https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html" rel="noopener noreferrer"&gt;&lt;code&gt;delay_on_commit()&lt;/code&gt; was added in Celery 5.4&lt;/a&gt; and wraps the hook for you, at the cost of not returning a task ID, since nothing is sent to the broker until the transaction finishes. Django's interface has no equivalent, so the &lt;code&gt;partial&lt;/code&gt; pattern is the one to standardise on in review.&lt;/p&gt;

&lt;p&gt;The other constraint worth internalising early: task arguments and return values are serialized to JSON, so &lt;code&gt;process_data.enqueue(datetime.now())&lt;/code&gt; raises &lt;code&gt;TypeError: Object of type datetime is not JSON serializable&lt;/code&gt;. Pass primary keys and ISO strings, re-fetch inside the task. That is good practice with any queue — it keeps tasks idempotent and avoids acting on a stale copy of an object — but here the framework enforces it rather than letting a pickle backend quietly hide the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the interface is still worth adopting
&lt;/h2&gt;

&lt;p&gt;I was ready to write this feature off as premature, and I have changed my mind on one point. The value is not that Django runs your tasks. It is that your application code stops naming the queue vendor.&lt;/p&gt;

&lt;p&gt;Two concrete payoffs. First, tests: point &lt;code&gt;TASKS&lt;/code&gt; at &lt;code&gt;DummyBackend&lt;/code&gt; and assertions run against enqueued tasks without a broker, an eager-mode flag, or a mocked &lt;code&gt;.delay&lt;/code&gt;. Second, migration cost: swapping the database backend for a Redis-backed one is a settings change plus a worker process, not a sweep through every module that imported &lt;code&gt;shared_task&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That is a real architectural gain for a codebase that expects to outgrow its first queue — which, in my experience, is most SaaS backends around the point the first customer asks for scheduled reports.&lt;/p&gt;

&lt;p&gt;The practical rule I would give anyone upgrading: adopt &lt;code&gt;@task&lt;/code&gt; and &lt;code&gt;.enqueue()&lt;/code&gt; for new background work, keep whatever runs your existing jobs, and do not delete the broker until you have picked and deployed a backend that has a worker in it. The API is stable and the ecosystem underneath it is not finished.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/topics/tasks/" rel="noopener noreferrer"&gt;Django's Tasks framework — topic guide (6.1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/ref/tasks/" rel="noopener noreferrer"&gt;Tasks reference: backends, capability flags, TaskResult (6.1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.djangoproject.com/weblog/2025/dec/03/django-60-released/" rel="noopener noreferrer"&gt;Django 6.0 released — 3 December 2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.1/releases/6.1/" rel="noopener noreferrer"&gt;Django 6.1 release notes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.djangoproject.com/weblog/2024/may/29/django-enhancement-proposal-14-background-workers/" rel="noopener noreferrer"&gt;Django Enhancement Proposal 14: Background Workers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/RealOrangeOne/django-tasks-db" rel="noopener noreferrer"&gt;django-tasks-db — ORM-based backend and db_worker command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.better-simple.com/django/2026/05/06/using-django-tasks-in-production/" rel="noopener noreferrer"&gt;Using Django Tasks in production — Better Simple&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.loopwerk.io/articles/2026/django-tasks-review/" rel="noopener noreferrer"&gt;Django 6.0 Tasks: a framework without a worker — Loopwerk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html" rel="noopener noreferrer"&gt;First steps with Django — Celery documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/django-tasks-api-without-a-worker/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>backend</category>
      <category>django</category>
      <category>python</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>What Postgres 18 Changes for a Django App</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Thu, 12 Nov 2026 21:51:06 +0000</pubDate>
      <link>https://dev.to/papansarkar101/what-postgres-18-changes-for-a-django-app-27e2</link>
      <guid>https://dev.to/papansarkar101/what-postgres-18-changes-for-a-django-app-27e2</guid>
      <description>&lt;p&gt;The first thing that happens when you point &lt;code&gt;pg_upgrade&lt;/code&gt; at a fresh PostgreSQL 18 cluster is, quite often, nothing. It refuses. That refusal is the most useful thing in this release for anyone running a Django app, because it forces you to look at a default that changed underneath you — and there are four more like it.&lt;/p&gt;

&lt;p&gt;PostgreSQL 18 was &lt;a href="https://www.postgresql.org/about/news/postgresql-18-released-3142/" rel="noopener noreferrer"&gt;released on 25 September 2025&lt;/a&gt;. Django 6.0 &lt;a href="https://docs.djangoproject.com/en/6.0/releases/6.0/" rel="noopener noreferrer"&gt;arrived that December&lt;/a&gt; and &lt;a href="https://docs.djangoproject.com/en/6.0/ref/databases/" rel="noopener noreferrer"&gt;supports PostgreSQL 14 and higher&lt;/a&gt;, so nothing in the ORM forces the move. What follows is what I actually check before moving a Django project onto 18, in the order the problems show up.&lt;/p&gt;

&lt;h2&gt;
  
  
  The upgrade refuses before it starts
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;initdb&lt;/code&gt; in 18 now &lt;a href="https://www.postgresql.org/docs/release/18.0/" rel="noopener noreferrer"&gt;defaults to enabling data checksums&lt;/a&gt;, with a new &lt;code&gt;--no-data-checksums&lt;/code&gt; flag to turn them off. &lt;code&gt;pg_upgrade&lt;/code&gt; requires that the old and new clusters agree on checksum settings. If your existing cluster was initialised without checksums — which is every cluster created by an older &lt;code&gt;initdb&lt;/code&gt; that nobody thought about — the new 18 cluster will not match it, and the upgrade stops.&lt;/p&gt;

&lt;p&gt;Two ways out, and they are not equivalent:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# A: accept the old cluster's setting, keep the upgrade short&lt;/span&gt;
initdb --no-data-checksums -D /var/lib/postgresql/18/main

&lt;span class="c"&gt;# B: turn checksums on in the old cluster first, then upgrade&lt;/span&gt;
pg_ctl -D /var/lib/postgresql/16/main stop
pg_checksums --enable -D /var/lib/postgresql/16/main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Option B is the one you want long term, but &lt;a href="https://www.postgresql.org/docs/18/app-pgchecksums.html" rel="noopener noreferrer"&gt;&lt;code&gt;pg_checksums&lt;/code&gt; requires the server to be shut down cleanly&lt;/a&gt; and rewrites every block with a changed checksum in place, so on a large database it turns a short maintenance window into a long one. On a client project with a tight window I take option A, note it in the runbook, and enable checksums on a later, quieter night. Deciding that during the outage is how windows get blown.&lt;/p&gt;

&lt;p&gt;While you are in &lt;code&gt;pg_upgrade&lt;/code&gt;, two new options are worth reading about: &lt;a href="https://www.postgresql.org/docs/release/18.0/" rel="noopener noreferrer"&gt;&lt;code&gt;--swap&lt;/code&gt;, which swaps directories instead of copying or linking files, and parallel database checks via the existing &lt;code&gt;--jobs&lt;/code&gt; option&lt;/a&gt;. &lt;code&gt;--swap&lt;/code&gt; is the fastest mode and also the least reversible, which is the trade-off you would expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Asynchronous I/O is on, with three worker processes
&lt;/h2&gt;

&lt;p&gt;The headline feature is the new asynchronous I/O subsystem, which the release announcement describes as giving &lt;a href="https://www.postgresql.org/about/news/postgresql-18-released-3142/" rel="noopener noreferrer"&gt;up to 3x performance improvements when reading from storage&lt;/a&gt; for sequential scans, bitmap heap scans and vacuum.&lt;/p&gt;

&lt;p&gt;The part that matters operationally is the configuration. &lt;a href="https://www.postgresql.org/docs/18/runtime-config-resource.html" rel="noopener noreferrer"&gt;&lt;code&gt;io_method&lt;/code&gt; defaults to &lt;code&gt;worker&lt;/code&gt;&lt;/a&gt;, with &lt;code&gt;io_uring&lt;/code&gt; available only in a build compiled against liburing, and &lt;code&gt;sync&lt;/code&gt; to fall back to the old behaviour. It can only be set at server start. The number of I/O worker processes is controlled by &lt;code&gt;io_workers&lt;/code&gt;, which &lt;a href="https://www.postgresql.org/docs/18/runtime-config-resource.html" rel="noopener noreferrer"&gt;defaults to 3&lt;/a&gt;, and &lt;code&gt;io_combine_limit&lt;/code&gt; &lt;a href="https://www.postgresql.org/docs/18/runtime-config-resource.html" rel="noopener noreferrer"&gt;defaults to 128kB&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So on a busy machine you inherit a small pool of I/O workers you never sized. Check what you actually got before assuming the benchmark applies to you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="no"&gt;SHOW&lt;/span&gt; &lt;span class="n"&gt;io_method&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;SHOW&lt;/span&gt; &lt;span class="n"&gt;io_workers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="no"&gt;SHOW&lt;/span&gt; &lt;span class="n"&gt;io_combine_limit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the kind of setting that a managed provider may pin for you, so check it on the instance rather than in your own &lt;code&gt;postgresql.conf&lt;/code&gt;. And treat the improvement as a hypothesis about your workload: the operations that benefit are large sequential reads and vacuum, which is a fine description of an analytics query over a fact table and a poor description of a Django admin page fetching forty rows by primary key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Skip scan, and the index it will not save
&lt;/h2&gt;

&lt;p&gt;For years the rule was that a composite B-tree index on &lt;code&gt;(a, b)&lt;/code&gt; was useless to a query that filtered only on &lt;code&gt;b&lt;/code&gt;. PostgreSQL 18 relaxes that: the planner can now use a multicolumn B-tree index &lt;a href="https://www.postgresql.org/docs/18/indexes-multicolumn.html" rel="noopener noreferrer"&gt;when there is no equality constraint on the leading column&lt;/a&gt; but there is one on a later column, by repeatedly searching for each value of the leading column.&lt;/p&gt;

&lt;p&gt;The caveat in the same page is the whole story, and it is the opposite of what the feature summaries imply. The docs say this approach is taken when there are so few distinct leading values that the scan skips most of the index, and that &lt;a href="https://www.postgresql.org/docs/18/indexes-multicolumn.html" rel="noopener noreferrer"&gt;if there are many distinct values the entire index has to be scanned&lt;/a&gt;, at which point the planner generally prefers a sequential scan.&lt;/p&gt;

&lt;p&gt;That flips the obvious Django use case on its head. Take the index every multi-tenant schema has:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;functions&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Now&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Invoice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;tenant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ForeignKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Tenant&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on_delete&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;CharField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max_length&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;db_default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;Now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Meta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;indexes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
            &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"tenant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Index&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fields&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"created_at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A cross-tenant report filtering only on &lt;code&gt;created_at&lt;/code&gt; will not be rescued by the first index once you have a few thousand tenants — too many distinct leading values. The second index is the candidate: &lt;code&gt;status&lt;/code&gt; has a handful of values, so a query filtering only on &lt;code&gt;created_at&lt;/code&gt; can plausibly skip through it. Same feature, same table, opposite outcome, decided entirely by cardinality.&lt;/p&gt;

&lt;p&gt;The practical move is not to delete any indexes. It is to take the three or four queries where you previously added a redundant single-column index purely to work around the leftmost rule, and re-run &lt;code&gt;EXPLAIN (ANALYZE, BUFFERS)&lt;/code&gt; on 18 to see whether the composite index now covers them. If it does, the redundant index is write amplification you can drop. If it does not, you learned that for the price of one query plan.&lt;/p&gt;

&lt;h2&gt;
  
  
  uuidv7() as a database default
&lt;/h2&gt;

&lt;p&gt;PostgreSQL 18 adds &lt;a href="https://www.postgresql.org/docs/release/18.0/" rel="noopener noreferrer"&gt;&lt;code&gt;uuidv7()&lt;/code&gt;, which generates timestamp-ordered UUIDs, along with a &lt;code&gt;uuidv4()&lt;/code&gt; alias&lt;/a&gt;. Time-ordered keys are the fix for the classic random-UUID primary key problem, where inserts scatter across the B-tree instead of appending to the right-hand edge.&lt;/p&gt;

&lt;p&gt;Django has no built-in wrapper for it — &lt;a href="https://docs.djangoproject.com/en/6.0/ref/contrib/postgres/functions/" rel="noopener noreferrer"&gt;&lt;code&gt;django.contrib.postgres.functions&lt;/code&gt; ships &lt;code&gt;RandomUUID&lt;/code&gt;, which returns a version 4 UUID&lt;/a&gt;. You write the function yourself, and hand it to &lt;code&gt;db_default&lt;/code&gt;, which &lt;a href="https://docs.djangoproject.com/en/6.0/ref/models/fields/" rel="noopener noreferrer"&gt;accepts a database function&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;
&lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;django&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;Func&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UUIDv7&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Func&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;function&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"uuidv7"&lt;/span&gt;
    &lt;span class="n"&gt;arity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="n"&gt;output_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;UUIDField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Event&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;UUIDField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;primary_key&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="n"&gt;db_default&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;UUIDv7&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;editable&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;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is a second option now, which is why this is a decision rather than a recipe: Python 3.14 &lt;a href="https://docs.python.org/3/library/uuid.html" rel="noopener noreferrer"&gt;added &lt;code&gt;uuid.uuid7()&lt;/code&gt;, generating a time-based UUID per RFC 9562&lt;/a&gt;. Generating the key in Python means you know the id before the &lt;code&gt;INSERT&lt;/code&gt; returns, which is what you want when you are writing related rows in one transaction or pushing an id into a queue payload. Generating it in the database means every writer gets ordered keys — including &lt;code&gt;COPY&lt;/code&gt;, a data migration written in raw SQL, and whatever the analytics team runs at two in the morning. I default to the database for anything with more than one writer, and to Python where the application needs the id first.&lt;/p&gt;

&lt;p&gt;Neither choice is free of the obvious caveat: a v7 UUID embeds a timestamp, so exposing one in a public URL leaks the creation time of the row. That is usually harmless and occasionally is not.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generated columns went virtual, and Django did not notice
&lt;/h2&gt;

&lt;p&gt;In 18, &lt;a href="https://www.postgresql.org/docs/release/18.0/" rel="noopener noreferrer"&gt;generated columns are now virtual by default, computing values when read rather than when written, with &lt;code&gt;STORED&lt;/code&gt; still available explicitly&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This does not change Django-managed columns, because Django never leaves it to the default: &lt;a href="https://docs.djangoproject.com/en/6.0/ref/models/fields/" rel="noopener noreferrer"&gt;&lt;code&gt;GeneratedField&lt;/code&gt; documents that PostgreSQL only supports persisted columns&lt;/a&gt;, so &lt;code&gt;db_persist=True&lt;/code&gt; is the only setting that works there and the emitted DDL says so. Where it bites is the &lt;code&gt;RunSQL&lt;/code&gt; migration somebody wrote by hand two years ago that says &lt;code&gt;GENERATED ALWAYS AS (...)&lt;/code&gt; with no &lt;code&gt;STORED&lt;/code&gt;. On 16 that was a syntax error and you fixed it at the time. On 18 it succeeds and quietly gives you a virtual column — a column your Django model cannot represent, and one that cannot be indexed the way the stored version could.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;grep -rn &lt;span class="s2"&gt;"GENERATED ALWAYS AS"&lt;/span&gt; --include=&lt;span class="s2"&gt;"*.py"&lt;/span&gt; */migrations/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run that before the upgrade, not after.&lt;/p&gt;

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

&lt;p&gt;Nothing here is a reason to upgrade on its own, and the 3x read number is not going to show up on your dashboard because you moved a Django CRUD app to a new major version. The reasons to go are the ordinary ones — support windows, your managed provider's roadmap, &lt;code&gt;uuidv7()&lt;/code&gt; if you were about to build it yourself in Python anyway.&lt;/p&gt;

&lt;p&gt;The reason to read the release notes rather than a feature list is that three of the five items above are changed defaults, not new features. Checksums, &lt;code&gt;io_method&lt;/code&gt; and virtual generated columns all behave differently on a cluster where you changed nothing. A major-version upgrade is the one moment when reading a changelog for defaults pays for itself, and it is the part everyone skips in favour of the benchmark headline.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.postgresql.org/about/news/postgresql-18-released-3142/" rel="noopener noreferrer"&gt;PostgreSQL 18 Released!&lt;/a&gt; — release announcement and the 3x read figure&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.postgresql.org/docs/release/18.0/" rel="noopener noreferrer"&gt;PostgreSQL 18.0 Release Notes&lt;/a&gt; — checksum default, &lt;code&gt;uuidv7()&lt;/code&gt;, virtual generated columns, &lt;code&gt;pg_upgrade --swap&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.postgresql.org/docs/18/runtime-config-resource.html" rel="noopener noreferrer"&gt;PostgreSQL 18: Resource Consumption configuration&lt;/a&gt; — &lt;code&gt;io_method&lt;/code&gt;, &lt;code&gt;io_workers&lt;/code&gt;, &lt;code&gt;io_combine_limit&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.postgresql.org/docs/18/indexes-multicolumn.html" rel="noopener noreferrer"&gt;PostgreSQL 18: Multicolumn Indexes&lt;/a&gt; — skip scan and its cardinality caveat&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.postgresql.org/docs/18/app-pgchecksums.html" rel="noopener noreferrer"&gt;PostgreSQL 18: pg_checksums&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.djangoproject.com/en/6.0/ref/databases/" rel="noopener noreferrer"&gt;Django 6.0: Databases&lt;/a&gt; — supported PostgreSQL versions&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.djangoproject.com/en/6.0/ref/models/fields/" rel="noopener noreferrer"&gt;Django 6.0: Model field reference&lt;/a&gt; — &lt;code&gt;db_default&lt;/code&gt; and &lt;code&gt;GeneratedField.db_persist&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.djangoproject.com/en/6.0/ref/contrib/postgres/functions/" rel="noopener noreferrer"&gt;Django 6.0: PostgreSQL-specific database functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://docs.python.org/3/library/uuid.html" rel="noopener noreferrer"&gt;Python 3.14: uuid module&lt;/a&gt; — &lt;code&gt;uuid.uuid7()&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/postgres-18-django-upgrade-notes/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>django</category>
      <category>postgres</category>
      <category>python</category>
    </item>
    <item>
      <title>Loom Alternative in 2026: Why I Switched to Cap</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Thu, 12 Nov 2026 20:51:11 +0000</pubDate>
      <link>https://dev.to/papansarkar101/loom-alternative-in-2026-why-i-switched-to-cap-1mg8</link>
      <guid>https://dev.to/papansarkar101/loom-alternative-in-2026-why-i-switched-to-cap-1mg8</guid>
      <description>&lt;p&gt;For about a year, Loom was one of the few tools I opened every working day. Bug reports went out as Loom links. Client handoffs were Loom walkthroughs. Demos for clients across several time zones were Loom videos they could watch in their own time. I never questioned it, because it worked.&lt;/p&gt;

&lt;p&gt;Then the ground under it moved. Loom is part of Atlassian now, the free Creator Lite role is being removed as accounts migrate to Atlassian billing, and the AI features sit on the most expensive self-serve tier. So I went looking for a Loom alternative. I found Cap, an open-source screen recorder, and I've since moved off Loom and use Cap for my recordings.&lt;/p&gt;

&lt;p&gt;Below: why I switched, where Cap is better, where it isn't, and who should actually switch.&lt;/p&gt;

&lt;p&gt;Prefer video? Here's the 5-minute version.&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/s631jhHMYsQ" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Loom got expensive in 2026
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.atlassian.com/blog/announcements/atlassian-acquires-loom" rel="noopener noreferrer"&gt;Atlassian acquired Loom in 2023&lt;/a&gt;. On its own that changed nothing day to day. The billing migration is what changes things. As Loom accounts move onto Atlassian billing, the free Creator Lite role goes away. &lt;a href="https://support.atlassian.com/loom/docs/loom-customer-integration-with-atlassian-pricing-billing-and-role-changes/" rel="noopener noreferrer"&gt;Atlassian's support page&lt;/a&gt; says Creator Lite users are upgraded to paid Creator seats on the integration date. You get a grace period until your next billing date to deactivate anyone you don't want to pay for. If your team had a few people recording occasionally on Creator Lite, some of them are about to become invoices.&lt;/p&gt;

&lt;p&gt;Loom pricing as of September 2026:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Starter:&lt;/strong&gt; free, 25 videos per person, 5 minutes per recording (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business:&lt;/strong&gt; $18/user/month billed monthly, about $15 billed annually (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Business + AI:&lt;/strong&gt; $24/user/month billed monthly, about $20 billed annually (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;). This is the tier with AI summaries, chapters and filler-word removal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Run that for a 10-person team that wants the AI features and pays monthly: 10 × $24 × 12 = &lt;strong&gt;$2,880 a year&lt;/strong&gt; (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;To be fair to Loom: it integrates with Jira and Confluence. If your team already lives in Atlassian's tools, that integration is worth real money. More on that below.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Cap?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://cap.so" rel="noopener noreferrer"&gt;Cap&lt;/a&gt; is an open-source screen recorder for macOS, Windows and Linux, plus a Chrome extension. The code is &lt;a href="https://github.com/CapSoftware/Cap" rel="noopener noreferrer"&gt;on GitHub&lt;/a&gt; with 22k+ stars. It's free for personal use, and commercial use needs a paid plan. It has two recording modes, Instant and Studio, and it lets you decide where your recordings are stored. It's currently at v0.6, which matters later in this post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Loom vs Cap: side-by-side comparison
&lt;/h2&gt;

&lt;p&gt;Pricing as of September 2026. Where a Loom cell says "not compared", I couldn't verify it, so I left it out rather than guess.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Loom&lt;/th&gt;
&lt;th&gt;Cap&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Free tier&lt;/td&gt;
&lt;td&gt;Starter: 25 videos per person, 5 min per recording (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;source&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;Personal use only; cloud links up to 5 min, no time limit on local Studio recordings (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;source&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Paid price&lt;/td&gt;
&lt;td&gt;Business $18/user/mo, Business + AI $24/user/mo, monthly (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;source&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;Desktop License $58 one-time or $29/yr; Cap Pro $12/user/mo monthly, $8.16/mo annual (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;source&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI features&lt;/td&gt;
&lt;td&gt;Summaries, chapters, filler-word removal on Business + AI&lt;/td&gt;
&lt;td&gt;Titles, summaries, chapters, transcripts on Cap Pro, no usage limits&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage&lt;/td&gt;
&lt;td&gt;Not compared&lt;/td&gt;
&lt;td&gt;Cap Cloud, your own S3 bucket, Google Drive, or self-host&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open source&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, on GitHub&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Platforms&lt;/td&gt;
&lt;td&gt;Not compared&lt;/td&gt;
&lt;td&gt;macOS 13.1+, Windows 10+, Linux, Chrome extension&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Editor&lt;/td&gt;
&lt;td&gt;Not compared&lt;/td&gt;
&lt;td&gt;Studio Mode: local 4K 60fps, separate tracks, auto-zoom, local captions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AI coding agent support&lt;/td&gt;
&lt;td&gt;Not compared&lt;/td&gt;
&lt;td&gt;CLI plus a local MCP server for Claude Code, Cursor and Codex&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The same 10-person team on Cap Pro, billed monthly, works out to 10 × $12 × 12 = $1,440 a year (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing&lt;/a&gt;), half the Loom figure above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Instant Mode vs Loom
&lt;/h2&gt;

&lt;p&gt;Instant Mode is the direct Loom replacement. It &lt;a href="https://cap.so" rel="noopener noreferrer"&gt;uploads while you record&lt;/a&gt;, so when you stop, the share link is already on your clipboard. Viewers watch in the browser and don't need an account. That's the Loom workflow, and for async bug reports it's the only part that matters: record, stop, paste into the ticket.&lt;/p&gt;

&lt;p&gt;The limits to know. On the free plan, cloud share links are capped at 5 minutes, the same ceiling as Loom's Starter recordings. The Desktop License adds commercial rights but still gives you 20 cloud links a month, up to 5 minutes each. Unlimited cloud links need Cap Pro.&lt;/p&gt;

&lt;p&gt;The real difference from Loom is price. On Cap Pro, every recording automatically gets a title, summary, chapters and a full transcript for $12 per user per month (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing&lt;/a&gt;). On Loom, that set of features is the $24 Business + AI tier (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Studio Mode: the editor
&lt;/h2&gt;

&lt;p&gt;Studio Mode records locally in 4K at 60fps, with screen, camera and mic on separate tracks. The separate tracks are what I care about most. You can fix a bad camera crop or a quiet mic after the fact instead of re-recording the whole take.&lt;/p&gt;

&lt;p&gt;On top of that, the editor has auto-zoom on clicks, cursor smoothing, blur for anything sensitive on screen, backgrounds, and captions generated locally in 19 languages (&lt;a href="https://cap.so" rel="noopener noreferrer"&gt;Cap&lt;/a&gt;). Local transcription means your audio doesn't have to leave your machine to get captions, which is useful if you record inside a client's product.&lt;/p&gt;

&lt;p&gt;Local Studio recordings have no time limit, even on the free plan.&lt;/p&gt;

&lt;p&gt;Studio Mode is what got me to switch. I use it pretty much every day now, and my recordings look far more presentable than they did on Loom. I've recommended Cap to clients too, and they've liked it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Owning your recordings
&lt;/h2&gt;

&lt;p&gt;For client work, this matters more to me than price. Cap lets you store recordings on Cap Cloud, in your own S3 bucket, in Google Drive, or on a self-hosted instance. Some clients don't want screens of their unreleased product sitting in a third-party account they don't control. With Cap you can point recordings at the client's own bucket or run the whole thing yourself. It also covers the worst case: with your own storage, Cap says &lt;a href="https://cap.so/self-hosted-screen-recording" rel="noopener noreferrer"&gt;your recordings live in your bucket "regardless of what happens to Cap's cloud offering"&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Cap also &lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;states SOC 2 Type II, ISO 27001 and HIPAA compliance&lt;/a&gt; on its site. I'm reporting what Cap says. I haven't audited it.&lt;/p&gt;

&lt;p&gt;If you have a Loom library, Cap has a Loom importer. Paste a Loom share link to bring over one video, or upload a CSV to bring over a whole library. Cap re-hosts each recording, keeps its title, and generates a transcript, summary and chapters for it (&lt;a href="https://cap.so/migrate-from-loom" rel="noopener noreferrer"&gt;migration guide&lt;/a&gt;). The importer is part of Cap Pro, not the free plan or the Desktop License. Code MIGRATE20 takes 20% off Pro (&lt;a href="https://cap.so/migrate-from-loom" rel="noopener noreferrer"&gt;migration guide&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The developer angle: a screen recorder for AI coding agents
&lt;/h2&gt;

&lt;p&gt;This is what made Cap interesting to me as a developer, not just cheaper.&lt;/p&gt;

&lt;p&gt;Cap ships a CLI and a local MCP server that exposes 76 tools over stdio (&lt;a href="https://cap.so/agents" rel="noopener noreferrer"&gt;Cap for agents&lt;/a&gt;). It works with Claude Code, Cursor and Codex. The tools cover recordings, transcripts, comments, sharing and analytics. The agent asks before it records, uploads or spends money, so it can't quietly start a screen capture or run up a bill. Credentials stay out of the conversation too. Cap's setup guide says &lt;a href="https://cap.so/docs/agents/setup" rel="noopener noreferrer"&gt;passwords and storage credentials should not appear as MCP inputs&lt;/a&gt;, so your keys never pass through the model.&lt;/p&gt;

&lt;p&gt;Setup starts with the CLI, per &lt;a href="https://cap.so/download" rel="noopener noreferrer"&gt;Cap's download page&lt;/a&gt; and &lt;a href="https://cap.so/docs/agents" rel="noopener noreferrer"&gt;agent docs&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install the Cap CLI&lt;/span&gt;
curl -fsSL https://cap.so/install-cli.sh &lt;span class="o"&gt;|&lt;/span&gt; sh

&lt;span class="c"&gt;# Expose Cap's tools to your agent over local stdio&lt;/span&gt;
cap mcp serve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's what that makes possible. Your agent fixes a bug, records a demo of the fix, and adds the video link to the pull request. There's no call and no long written explanation, because the proof is right there in the PR. It works the other way too: the agent can read a recording's transcript back, so a client's bug-report video becomes context it can work from. To be clear, I haven't wired this into my own agent setup yet, so this is what Cap supports, not something I'm reporting results on. If you're setting up agents in your editor, I covered that in &lt;a href="https://papansarkar.com/blog/using-ai-agents-in-vscode/" rel="noopener noreferrer"&gt;Using AI Agents in VS Code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest downsides
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It's v0.6.&lt;/strong&gt; It's a young product, so expect the occasional rough patch. It's improving, but you're adopting something still in early versions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free doesn't cover client work.&lt;/strong&gt; The free plan is for personal use. If you record for clients, the cheapest legal option is the Desktop License at $29/yr (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Desktop License is tight for heavy async use.&lt;/strong&gt; 20 cloud links a month, 5 minutes each, runs out fast if Loom-style links are how you talk to clients.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The good parts cost extra.&lt;/strong&gt; The Loom importer, AI summaries and unlimited cloud links all need Cap Pro.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switching has a social cost.&lt;/strong&gt; Clients and teammates have to get used to a new kind of link. That cost doesn't show up in a pricing table.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jira and Confluence.&lt;/strong&gt; If your team runs on Atlassian, Loom's integration is a real advantage.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Who should switch to Cap, and who should stay on Loom
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Switch to Cap if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're a solo developer or creator. For personal use it's free, so download it and try it. If you record client work, budget for the Desktop License.&lt;/li&gt;
&lt;li&gt;Your team pays Loom for AI features. Cap Pro gives you titles, summaries, chapters and transcripts at half the per-seat price on monthly billing, $12 against $24 (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing&lt;/a&gt;, &lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;You pay for Loom yourself or for a small team, and per-seat pricing hurts.&lt;/li&gt;
&lt;li&gt;You're on a Creator Lite seat that's about to become paid.&lt;/li&gt;
&lt;li&gt;You need control over where recordings live, such as a client's S3 bucket or a self-hosted instance.&lt;/li&gt;
&lt;li&gt;You make polished demos and want a real editor with separate tracks.&lt;/li&gt;
&lt;li&gt;You work with AI coding agents and want recordings they can reach.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Stay on Loom if:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your company runs on Jira and Confluence and actually uses the integration.&lt;/li&gt;
&lt;li&gt;Your organisation already pays for Loom and the switching effort outweighs the savings.&lt;/li&gt;
&lt;li&gt;You can't tolerate v0.6 rough edges in a tool you use every day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My call: I've moved off Loom, mostly for Studio Mode and for control over where client recordings live. If your organisation runs on Atlassian, staying on Loom is a perfectly reasonable decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Is Cap really free?
&lt;/h3&gt;

&lt;p&gt;For personal use, yes. Local Studio recordings have no time limit, and free cloud share links are capped at 5 minutes. Commercial use needs the Desktop License ($58 one-time or $29/yr) or Cap Pro (&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I import my Loom videos into Cap?
&lt;/h3&gt;

&lt;p&gt;Yes. Paste a single Loom link, or upload a CSV to import in bulk. The importer is a Cap Pro feature, and MIGRATE20 takes 20% off Pro (&lt;a href="https://cap.so/migrate-from-loom" rel="noopener noreferrer"&gt;migration guide&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Is Cap better than Loom?
&lt;/h3&gt;

&lt;p&gt;It depends on what you need. Cap is cheaper, and it offers a local 4K editor, a choice of where your recordings are stored, and support for AI coding agents. Loom wins on maturity and on its Jira and Confluence integration. Cap is at v0.6, and Loom is a mature product backed by Atlassian.&lt;/p&gt;

&lt;h3&gt;
  
  
  How much does Loom cost in 2026?
&lt;/h3&gt;

&lt;p&gt;As of September 2026, Starter is free (25 videos, 5 minutes each). Business is $18/user/month and Business + AI is $24/user/month on monthly billing, a bit less on annual billing (&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  Does Cap work on Linux?
&lt;/h3&gt;

&lt;p&gt;Yes. Cap offers Linux builds alongside macOS 13.1+ and Windows 10+, plus a Chrome extension (&lt;a href="https://cap.so/download" rel="noopener noreferrer"&gt;Cap download&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Loom is still a good product. Under Atlassian billing it costs more for small teams, and the free seats that made it easy to spread are going away. Cap covers the Loom workflow with Instant Mode and adds a real editor, control over where recordings live, and support for AI coding agents. The trade-off is a v0.6 product and paid plans for anything commercial.&lt;/p&gt;

&lt;p&gt;If you'd rather see it than read it, the &lt;a href="https://youtu.be/s631jhHMYsQ" rel="noopener noreferrer"&gt;5-minute video&lt;/a&gt; covers the same ground. And if you're building a product and want an engineer who ships fast and documents the work clearly, &lt;a href="https://papansarkar.com/contact/" rel="noopener noreferrer"&gt;get in touch&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.loom.com/pricing" rel="noopener noreferrer"&gt;Loom pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://support.atlassian.com/loom/docs/loom-customer-integration-with-atlassian-pricing-billing-and-role-changes/" rel="noopener noreferrer"&gt;Loom customer integration with Atlassian: pricing, billing and role changes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.atlassian.com/blog/announcements/atlassian-acquires-loom" rel="noopener noreferrer"&gt;Atlassian is acquiring Loom (Atlassian blog, October 2023)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so" rel="noopener noreferrer"&gt;Cap homepage: Instant Mode, Studio Mode, platforms, storage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/pricing" rel="noopener noreferrer"&gt;Cap pricing and compliance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/download" rel="noopener noreferrer"&gt;Cap download page and CLI install&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/faq" rel="noopener noreferrer"&gt;Cap FAQ&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/self-hosted-screen-recording" rel="noopener noreferrer"&gt;Cap self-hosted screen recording&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/docs/agents/setup" rel="noopener noreferrer"&gt;Cap agent setup guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/migrate-from-loom" rel="noopener noreferrer"&gt;Migrate from Loom to Cap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/agents" rel="noopener noreferrer"&gt;Cap for AI agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cap.so/docs/agents" rel="noopener noreferrer"&gt;Cap agent docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/CapSoftware/Cap" rel="noopener noreferrer"&gt;Cap on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/loom-alternative-cap-review/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>productivity</category>
      <category>saas</category>
      <category>tools</category>
    </item>
    <item>
      <title>The AI Productivity Paradox: More Starts, Fewer Finishes</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Mon, 02 Nov 2026 08:30:09 +0000</pubDate>
      <link>https://dev.to/papansarkar101/the-ai-productivity-paradox-more-starts-fewer-finishes-3gk1</link>
      <guid>https://dev.to/papansarkar101/the-ai-productivity-paradox-more-starts-fewer-finishes-3gk1</guid>
      <description>&lt;p&gt;AI didn't give developers more free time. It gave us more starts.&lt;/p&gt;

&lt;p&gt;I'm a senior full-stack engineer and I use coding agents every day. Our capacity to implement ideas has grown much faster than our capacity to think them through. The numbers show it too. In Faros AI's telemetry from more than 10,000 developers, high-AI teams merged 98% more pull requests, but PR review time rose 91% and delivery at the company level didn't improve (&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I think that's the real shift, and it's a management problem, not a tooling one.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cheap implementation removed the old filter.&lt;/strong&gt; When a feature took a month, the cost made you choose. Now a prototype takes an afternoon, so nothing makes you choose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The data backs this up.&lt;/strong&gt; In Faros AI's telemetry, developers on high-AI teams touched 47% more pull requests a day, and PR review time rose 91% (&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;). A Berkeley study found that AI intensified work instead of reducing it (&lt;a href="https://hbr.org/2026/02/ai-doesnt-reduce-work-it-intensifies-it" rel="noopener noreferrer"&gt;HBR&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better tools won't fix it.&lt;/strong&gt; Google's DORA research found friction and burnout "unaffected by AI" (&lt;a href="https://jellyfish.co/blog/2025-dora-report/" rel="noopener noreferrer"&gt;Jellyfish on DORA 2025&lt;/a&gt;). A tool can't decide what's worth doing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three rules I'd protect:&lt;/strong&gt; one thing in progress per product, a written "done" before any code, and a weekly review of what to kill.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why does AI make developers busier instead of freer?
&lt;/h2&gt;

&lt;p&gt;Before coding agents, the cost of building did your prioritisation for you. If a feature took three weeks, you argued about it first. You wrote it down, cut scope and said no to the other four ideas, because you could see what they would cost. Most bad ideas died in that conversation, before anyone wrote code.&lt;/p&gt;

&lt;p&gt;That filter is gone. Starting something now costs a prompt and a coffee. Finishing it costs what it always did: review, tests, edge cases, deployment, docs, support and, above all, the decisions. Every thing you start keeps a claim on your attention. It might be an open branch, a prototype that half works, or an agent waiting for an answer.&lt;/p&gt;

&lt;p&gt;In practice it looks like this. You have three agent sessions open. None of them needs you all the time, but each one periodically needs a decision, a review or an answer. Every one of those is a context switch. A new model ships, the ideas come faster, you start more, and a few weeks later the review queue and the switching catch up with you.&lt;/p&gt;

&lt;p&gt;Simon Willison described this pattern in February. He often runs two or three projects in parallel and gets a lot done, but his mental energy is mostly gone after an hour or two (&lt;a href="https://simonwillison.net/2026/Feb/9/ai-intensifies-work/" rel="noopener noreferrer"&gt;Simon Willison&lt;/a&gt;). That isn't a complaint about the tools. It's what happens when the number of open loops goes up and the person holding them stays the same.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the research says about AI and workload
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The work got more intense, not smaller.&lt;/strong&gt; Aruna Ranganathan and Xingqi Maggie Ye of Berkeley Haas spent April to December 2025 studying about 200 employees at a US tech company where AI use was optional (&lt;a href="https://hbr.org/2026/02/ai-doesnt-reduce-work-it-intensifies-it" rel="noopener noreferrer"&gt;HBR&lt;/a&gt;). People took on a wider range of tasks, and work spilled into more hours of the day. Engineers spent more time reviewing and cleaning up colleagues' AI-generated output (&lt;a href="https://www.thestar.com.my/tech/tech-news/2026/02/18/ai-promised-to-save-time-researchers-find-its-doing-the-opposite" rel="noopener noreferrer"&gt;The Star, via Inc.&lt;/a&gt;). The authors describe "a growing number of open tasks" and "a sense of always juggling, even as the work felt productive" (&lt;a href="https://simonwillison.net/2026/Feb/9/ai-intensifies-work/" rel="noopener noreferrer"&gt;Simon Willison, quoting HBR&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;People produced more, but companies didn't deliver more.&lt;/strong&gt; Faros AI analysed telemetry from more than 10,000 developers across 1,255 teams (&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;). Here is what changed on teams with high AI adoption:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric (high-AI teams)&lt;/th&gt;
&lt;th&gt;Change&lt;/th&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tasks completed&lt;/td&gt;
&lt;td&gt;+21%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pull requests merged&lt;/td&gt;
&lt;td&gt;+98%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tasks touched per developer per day&lt;/td&gt;
&lt;td&gt;+9%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PRs touched per developer per day&lt;/td&gt;
&lt;td&gt;+47%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PR review time&lt;/td&gt;
&lt;td&gt;+91%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Average PR size&lt;/td&gt;
&lt;td&gt;+154%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bugs per developer&lt;/td&gt;
&lt;td&gt;+9%&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Faros's conclusion: "no significant correlation between AI adoption and improvements at the company level" (&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI&lt;/a&gt;). Read the table as one story. People started more, touched more and opened bigger changes. Then all of it queued up for the same few reviewers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This was visible before agents.&lt;/strong&gt; In 2024, 77% of employees who use AI told the Upwork Research Institute the tools had added to their workload, and 39% pointed to time spent reviewing or moderating AI content (&lt;a href="https://www.upwork.com/press/releases/upwork-study-finds-employee-workloads-rising-despite-increased-c-suite-investment-in-artificial-intelligence" rel="noopener noreferrer"&gt;Upwork&lt;/a&gt;). In Atlassian's 2025 survey of 3,500 developers and managers, 68% said AI saved them more than 10 hours a week, while 50% lost 10 or more hours a week, mostly to organisational inefficiency (&lt;a href="https://www.atlassian.com/blog/developer/developer-experience-report-2025" rel="noopener noreferrer"&gt;Atlassian&lt;/a&gt;). Saving time on typing doesn't help if the system around you can't take in what you produce.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switching costs aren't new either.&lt;/strong&gt; Gerald Weinberg's rule of thumb, as Johanna Rothman summarised it: a person on two tasks spends about 40% of their time on each and wastes 20%, and a person on four tasks spends 10% on each and wastes 60% (&lt;a href="https://ayeconference.com/multiprojecting-the-illusion-of-progress.html" rel="noopener noreferrer"&gt;Rothman&lt;/a&gt;). Weinberg meant those as estimates, not measurements. A 2017 study in an educational setting measured a smaller but real cost: developers on two or more projects spent about 17% of their effort on cross-project interruptions (&lt;a href="https://neverworkintheory.org/2021/09/19/impact-of-task-switching-and-work-interruptions.html" rel="noopener noreferrer"&gt;Tregubov et al., via Never Work in Theory&lt;/a&gt;). Gloria Mark's lab found that interrupted people work faster to compensate, but report more stress, frustration and time pressure (&lt;a href="https://www.ics.uci.edu/~gmark/chi08-mark.pdf" rel="noopener noreferrer"&gt;Mark et al., CHI 2008&lt;/a&gt;). That describes running five agents at once pretty well.&lt;/p&gt;

&lt;h2&gt;
  
  
  The case that this is fine
&lt;/h2&gt;

&lt;p&gt;I want to be fair to the other side. The 2025 DORA findings are more positive than the anecdotes. Individual effectiveness rose the most with AI adoption, throughput and time on valuable work improved, and burnout didn't get worse on average (&lt;a href="https://jellyfish.co/blog/2025-dora-report/" rel="noopener noreferrer"&gt;Jellyfish on DORA 2025&lt;/a&gt;). I'll add my own experience: the work is more fun without the boilerplate.&lt;/p&gt;

&lt;p&gt;I agree with all of that, and it supports my point. DORA's headline is that AI is "an amplifier," magnifying an organisation's existing strengths and weaknesses (&lt;a href="https://dora.dev/research/2025/dora-report/" rel="noopener noreferrer"&gt;DORA 2025&lt;/a&gt;). If you already had a filter, AI makes you faster at the things that pass it. If cost was your only filter, AI took it away and gave you nothing in its place.&lt;/p&gt;

&lt;p&gt;DORA's own follow-up says this plainly. Two of its seven AI capabilities are working in small batches and keeping a user-centric focus. As DORA puts it, "Speed is irrelevant if you are moving in the wrong direction" (&lt;a href="https://cloud.google.com/blog/products/ai-machine-learning/from-adoption-to-impact-putting-the-dora-ai-capabilities-model-to-work" rel="noopener noreferrer"&gt;Google Cloud&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  It's a management problem, not a tooling one
&lt;/h2&gt;

&lt;p&gt;The common response to "I'm drowning in agent output" is more tooling: an orchestrator, a dashboard of sessions, an agent that manages your agents. Every one of those makes starting even cheaper, so you end up with more starts.&lt;/p&gt;

&lt;p&gt;What's scarce is attention and judgement, so manage them the way teams have always managed scarce capacity: limit work in progress. The Kanban Guide's rule is that you "must explicitly control the number of work items in a workflow from started to finished" (&lt;a href="https://kanbanguides.org/english/" rel="noopener noreferrer"&gt;Kanban Guide&lt;/a&gt;). Basecamp's Shape Up makes the same point about scope: "Estimates start with a design and end with a number. Appetites start with a number and end with a design" (&lt;a href="https://basecamp.com/shapeup/1.2-chapter-03" rel="noopener noreferrer"&gt;Shape Up, ch. 3&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Here's how I think about it. For years, the cost of building did three jobs we never had to do on purpose. Now each one needs a rule.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What the cost of building used to do&lt;/th&gt;
&lt;th&gt;What it looks like now&lt;/th&gt;
&lt;th&gt;The rule that replaces it&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Forced you to pick one idea&lt;/td&gt;
&lt;td&gt;Five prototypes in a week&lt;/td&gt;
&lt;td&gt;One thing in progress per product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Forced you to think before building&lt;/td&gt;
&lt;td&gt;The agent builds before you've decided&lt;/td&gt;
&lt;td&gt;A written "done" before any code&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Killed weak ideas before they started&lt;/td&gt;
&lt;td&gt;Weak ideas live on as stale branches&lt;/td&gt;
&lt;td&gt;A weekly review of what to kill&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Rule 1: One thing in progress per product
&lt;/h2&gt;

&lt;p&gt;"In progress" means it has a branch, an agent session waiting on you, or a PR that isn't merged. Each product gets one of those at a time. It's one per product, not one per person, because most of us (me included) work across several codebases. The point is that every product has a single lane.&lt;/p&gt;

&lt;p&gt;Agents can still run in parallel inside that lane. One writes tests, one drafts the migration and one updates the docs, all for the same feature. What the rule stops is five agents building five different features that all land on your review queue on Thursday.&lt;/p&gt;

&lt;p&gt;New ideas go on a list, not into a branch. A list costs nothing to keep. A branch costs attention every time you see it.&lt;/p&gt;

&lt;p&gt;There are two exceptions. A production incident overrides everything. A spike (a short experiment to answer a question) is allowed, but it gets a time box, a label, and by default it's thrown away when the time runs out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 2: A written "done" before any code
&lt;/h2&gt;

&lt;p&gt;Two lines is enough. If you can't write them, you don't understand the work yet, and an agent will happily build the wrong thing very fast. This is the thinking that the cost of building used to force on you. Now you have to do it on purpose.&lt;/p&gt;

&lt;p&gt;I keep a short file at the root of the branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# DONE.md: checkout-retry
Done when: a failed card payment retries once after 24 hours and the
           customer gets exactly one email, not three.
Not doing: dunning sequences, SMS, admin UI changes.
Appetite: 2 days. Not merged by Friday = cut scope or kill it. No extensions.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Not doing" is the line that matters most. It keeps the agent from gold-plating, and it keeps me from "while I'm in here" detours. The "Done when" line goes straight into the agent prompt, which is the same habit I covered in &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;Use AI Coding Agents Like a Pro&lt;/a&gt;. The appetite line comes from Shape Up: you decide how much the work is worth before you see the design.&lt;/p&gt;

&lt;p&gt;Do the thinking away from the LLM. Write the done on paper or in a plain file before you open the agent. Once a chat session is open, it pulls you toward starting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 3: A weekly look at what you started and should kill
&lt;/h2&gt;

&lt;p&gt;Every Friday I spend 20 minutes listing everything open: branches, draft PRs, prototypes, agent threads, and anything I called a "quick experiment". Each item gets one of three verdicts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Finish it next week.&lt;/strong&gt; It moves to the single in-progress slot, or waits for it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Park it.&lt;/strong&gt; Write one paragraph on what you learned, then delete the branch. The paragraph is what you were actually keeping anyway.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kill it.&lt;/strong&gt; This is the default.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The default comes from Shape Up's "circuit breaker": "If they don't finish, by default the project doesn't get an extension" (&lt;a href="https://basecamp.com/shapeup/2.2-chapter-08" rel="noopener noreferrer"&gt;Shape Up, ch. 8&lt;/a&gt;). Basecamp's reasoning is that one runaway project should never freeze newer projects that could matter more. With AI that matters even more, because restarting is cheap. A killed idea that turns out to be good costs you an afternoon to rebuild, and it'll be better the second time because you'll write the done first.&lt;/p&gt;

&lt;p&gt;To get the list, I run this in each repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Local branches with no commits in the last 7 days, oldest first&lt;/span&gt;
git &lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="nt"&gt;-each-ref&lt;/span&gt; &lt;span class="nt"&gt;--sort&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;committerdate refs/heads/ &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--format&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'%(committerdate:short) %(refname:short)'&lt;/span&gt; |
  &lt;span class="nb"&gt;awk&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nv"&gt;cutoff&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="nt"&gt;-v-7d&lt;/span&gt; +%F 2&amp;gt;/dev/null &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;date&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'7 days ago'&lt;/span&gt; +%F&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s1"&gt;'$1 &amp;lt; cutoff'&lt;/span&gt;

&lt;span class="c"&gt;# Your open pull requests (GitHub CLI)&lt;/span&gt;
gh &lt;span class="nb"&gt;pr &lt;/span&gt;list &lt;span class="nt"&gt;--author&lt;/span&gt; &lt;span class="s2"&gt;"@me"&lt;/span&gt; &lt;span class="nt"&gt;--state&lt;/span&gt; open
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;date&lt;/code&gt; fallback covers both macOS and Linux. Anything that shows up two Fridays in a row doesn't get a third.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before you start the next thing
&lt;/h2&gt;

&lt;p&gt;Ask yourself these before you open a new branch or agent session:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is something already in progress on this product? Finish it or kill it first.&lt;/li&gt;
&lt;li&gt;Can I write "done when" in two lines, with a "not doing" line?&lt;/li&gt;
&lt;li&gt;What's the appetite, and what happens when it runs out?&lt;/li&gt;
&lt;li&gt;Who reviews this, and do they have room this week?&lt;/li&gt;
&lt;li&gt;If this took a month instead of an afternoon, would I still build it?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The last question is my favourite. It puts back the filter that cost used to provide, without the cost.&lt;/p&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;AI made implementation cheap and left judgement as expensive as ever. If you don't decide what not to build, you end up with a pile of half-finished work and a tired team. Shipping fast still matters, but speed without a filter just turns into a longer to-do list.&lt;/p&gt;

&lt;p&gt;If you're a founder planning an MVP and you want speed that turns into shipped features, this is how I run my projects: one lane per product, a written done for every feature, and a weekly cut. I build React/Next.js and Node.js products for clients. &lt;a href="https://papansarkar.com/contact/" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt;. If you're a developer, the agent-side habits are in &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;Use AI Coding Agents Like a Pro&lt;/a&gt;, and my two-agent review loop is in &lt;a href="https://papansarkar.com/blog/claude-code-vs-codex-use-both/" rel="noopener noreferrer"&gt;Claude Code vs Codex: How I Use Both on One Repo&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.faros.ai/blog/ai-software-engineering" rel="noopener noreferrer"&gt;Faros AI: The AI Productivity Paradox Research Report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://hbr.org/2026/02/ai-doesnt-reduce-work-it-intensifies-it" rel="noopener noreferrer"&gt;Harvard Business Review: AI Doesn't Reduce Work—It Intensifies It&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://simonwillison.net/2026/Feb/9/ai-intensifies-work/" rel="noopener noreferrer"&gt;Simon Willison: AI intensifies work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.thestar.com.my/tech/tech-news/2026/02/18/ai-promised-to-save-time-researchers-find-its-doing-the-opposite" rel="noopener noreferrer"&gt;The Star (Inc./TNS): AI promised to save time. Researchers find it's doing the opposite&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.upwork.com/press/releases/upwork-study-finds-employee-workloads-rising-despite-increased-c-suite-investment-in-artificial-intelligence" rel="noopener noreferrer"&gt;Upwork: Employee workloads rising despite C-suite investment in AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.atlassian.com/blog/developer/developer-experience-report-2025" rel="noopener noreferrer"&gt;Atlassian: State of Developer Experience 2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dora.dev/research/2025/dora-report/" rel="noopener noreferrer"&gt;DORA: 2025 State of AI-assisted Software Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://jellyfish.co/blog/2025-dora-report/" rel="noopener noreferrer"&gt;Jellyfish: AI as Amplifier, the 2025 DORA Report with Nathen Harvey&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/blog/products/ai-machine-learning/from-adoption-to-impact-putting-the-dora-ai-capabilities-model-to-work" rel="noopener noreferrer"&gt;Google Cloud: Putting the DORA AI Capabilities Model to work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://kanbanguides.org/english/" rel="noopener noreferrer"&gt;The Kanban Guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://basecamp.com/shapeup/1.2-chapter-03" rel="noopener noreferrer"&gt;Shape Up, Chapter 3: Set Boundaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://basecamp.com/shapeup/2.2-chapter-08" rel="noopener noreferrer"&gt;Shape Up, Chapter 8: The Betting Table&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ayeconference.com/multiprojecting-the-illusion-of-progress.html" rel="noopener noreferrer"&gt;Johanna Rothman: Multiprojecting, the Illusion of Progress&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://neverworkintheory.org/2021/09/19/impact-of-task-switching-and-work-interruptions.html" rel="noopener noreferrer"&gt;Never Work in Theory: Impact of Task Switching and Work Interruptions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.ics.uci.edu/~gmark/chi08-mark.pdf" rel="noopener noreferrer"&gt;Mark, Gudith and Klocke: The Cost of Interrupted Work, CHI 2008&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/ai-productivity-paradox-more-starts/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Claude Code vs Codex: How I Use Both on One Repo</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Sun, 01 Nov 2026 12:10:04 +0000</pubDate>
      <link>https://dev.to/papansarkar101/claude-code-vs-codex-how-i-use-both-on-one-repo-57gh</link>
      <guid>https://dev.to/papansarkar101/claude-code-vs-codex-how-i-use-both-on-one-repo-57gh</guid>
      <description>&lt;p&gt;Claude Code leads the coding-agent tools in Stack Overflow's 2026 survey at 66%, ahead of GitHub Copilot at 59% (&lt;a href="https://survey.stackoverflow.co/2026/ai" rel="noopener noreferrer"&gt;Stack Overflow 2026&lt;/a&gt;). Codex passed 5 million weekly active users in June, by OpenAI's own count (&lt;a href="https://constellationr.com/insights/news/openai-touts-broadening-codex-usage-5-million-weekly-active-users" rel="noopener noreferrer"&gt;Constellation Research&lt;/a&gt;). Most "Claude Code vs Codex" posts try to name a winner. I run both on the same repo, and I've found it more useful to ask which job goes to which agent, and how to keep the two from drifting apart.&lt;/p&gt;

&lt;p&gt;This post covers what each tool does better as of late October 2026, one instruction file both of them read, and the loop where one agent writes and the other reviews. The general habits (context, prompts, model choice) are in &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;Use AI Coding Agents Like a Pro&lt;/a&gt;, so I won't repeat them here.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Same entry price, different defaults.&lt;/strong&gt; Both are included in their vendor's $20/month individual plan (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;, &lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;Codex pricing&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code drives my interactive work.&lt;/strong&gt; You can switch permission modes mid-session, hooks enforce hard rules, and its review runs in the background.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codex is my second opinion and my scripted worker.&lt;/strong&gt; It sandboxes at the OS level by default, its scripted mode starts read-only, and its GitHub reviews flag only P0 and P1 issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One AGENTS.md serves both.&lt;/strong&gt; Codex reads it natively. Claude Code reads it too, or imports it from CLAUDE.md with one line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Have the agent that didn't write the code review it.&lt;/strong&gt; Models favour their own output, and that bias does the most damage when the model got it wrong.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Claude Code vs Codex at a glance
&lt;/h2&gt;

&lt;p&gt;I checked every row against both vendors' docs on 30 October 2026. Both products ship changes weekly, so confirm a detail on the linked page before you rely on it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Claude Code&lt;/th&gt;
&lt;th&gt;Codex&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where it runs&lt;/td&gt;
&lt;td&gt;Terminal, VS Code, JetBrains, desktop app, web (&lt;a href="https://code.claude.com/docs/en/overview" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;CLI, IDE extension, ChatGPT desktop, web and mobile, Codex Cloud (&lt;a href="https://learn.chatgpt.com/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cheapest plan with it&lt;/td&gt;
&lt;td&gt;Pro: $20/month, or $17/month billed annually (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;Included from ChatGPT Free upward; Go is $8/month, Plus $20/month (&lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Heavy-use tier&lt;/td&gt;
&lt;td&gt;Max, from $100/month (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;Pro, from $100/month, currently with no five-hour limit (&lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;pricing&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Instruction file&lt;/td&gt;
&lt;td&gt;CLAUDE.md; reads AGENTS.md if there's no CLAUDE.md (&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;AGENTS.md, merged from the repo root down to your folder (&lt;a href="https://learn.chatgpt.com/docs/agent-configuration/agents-md" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safety default&lt;/td&gt;
&lt;td&gt;Auto mode, where a classifier checks actions; the OS-level Bash sandbox is opt-in (&lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;OS-level sandbox in &lt;code&gt;workspace-write&lt;/code&gt; mode (&lt;a href="https://learn.chatgpt.com/docs/sandboxing" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scripted mode&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;claude -p&lt;/code&gt; (&lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;codex exec&lt;/code&gt;, read-only by default (&lt;a href="https://learn.chatgpt.com/docs/non-interactive-mode" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local review&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/code-review&lt;/code&gt;, on any plan (&lt;a href="https://code.claude.com/docs/en/code-review-local" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/review&lt;/code&gt;, or &lt;code&gt;codex review --base main&lt;/code&gt; (&lt;a href="https://learn.chatgpt.com/docs/code-review" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub PR review&lt;/td&gt;
&lt;td&gt;Managed Code Review, Team and Enterprise plans only (&lt;a href="https://code.claude.com/docs/en/code-review" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;@codex review&lt;/code&gt; or automatic reviews (&lt;a href="https://learn.chatgpt.com/docs/third-party/github" rel="noopener noreferrer"&gt;docs&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Open source&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;CLI is Apache-2.0 (&lt;a href="https://github.com/openai/codex" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I left benchmark scores and model names out on purpose. Both lineups have changed several times this year, and published comparisons disagree with each other by wide margins. Test both on a real ticket from your own codebase instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Both are safe bets now
&lt;/h2&gt;

&lt;p&gt;If you're a founder or CTO deciding which one your team should pay for, the market data says neither is a fringe pick:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;73% of respondents in Stack Overflow's 2026 survey use coding assistants and agents daily (&lt;a href="https://survey.stackoverflow.co/2026/ai" rel="noopener noreferrer"&gt;Stack Overflow 2026&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Anthropic said in February that Claude Code's run-rate revenue had passed $2.5 billion and that weekly users had doubled since January 1 (&lt;a href="https://www.anthropic.com/news/anthropic-raises-30-billion-series-g-funding-380-billion-post-money-valuation" rel="noopener noreferrer"&gt;Anthropic&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;OpenAI said in June that Codex had more than 5 million weekly active users, up more than 6x since its desktop app launched in February (&lt;a href="https://constellationr.com/insights/news/openai-touts-broadening-codex-usage-5-million-weekly-active-users" rel="noopener noreferrer"&gt;Constellation Research&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;The open-source Codex CLI repo has more than 130,000 GitHub stars (&lt;a href="https://github.com/openai/codex" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both companies report their own numbers, and they measure different things (revenue versus weekly users), so don't read them as a head-to-head. The point is simpler: both tools will be around, so choose by how your team works, not by which vendor might fold.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Claude Code wins for me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Steering while it works.&lt;/strong&gt; &lt;code&gt;Shift+Tab&lt;/code&gt; cycles permission modes mid-session: manual approval, auto-accept edits, and plan (&lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;permission modes&lt;/a&gt;). On code I don't know yet, I start in plan mode, read the plan, then let it edit. That back-and-forth is where Claude Code feels best.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules that are actually enforced.&lt;/strong&gt; An instruction file is a suggestion. Anthropic's docs say it plainly: Claude treats CLAUDE.md "as context, not enforced configuration," and to block an action no matter what, you use a PreToolUse hook (&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;memory docs&lt;/a&gt;). "Never edit the migrations folder" belongs in a hook, not in a paragraph.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Review that doesn't flood the session.&lt;/strong&gt; &lt;code&gt;/code-review&lt;/code&gt; runs as a background subagent with its own context window, so the findings arrive without filling your conversation (&lt;a href="https://code.claude.com/docs/en/code-review-local" rel="noopener noreferrer"&gt;code review docs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One config across surfaces.&lt;/strong&gt; The terminal, IDE, desktop and web surfaces share one engine, so the same CLAUDE.md, settings and MCP servers work in all of them (&lt;a href="https://code.claude.com/docs/en/overview" rel="noopener noreferrer"&gt;overview&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Codex wins for me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sandbox first.&lt;/strong&gt; Codex enforces its sandbox at the OS level: Seatbelt on macOS, bubblewrap on Linux and WSL2, and a native sandbox on Windows. The default mode lets it edit files and run routine commands inside the workspace, and nothing outside it (&lt;a href="https://learn.chatgpt.com/docs/sandboxing" rel="noopener noreferrer"&gt;sandboxing&lt;/a&gt;). Since I was handed a Next.js repo &lt;a href="https://papansarkar.com/blog/npm-malware-hidden-in-tailwind-config/" rel="noopener noreferrer"&gt;wired to run malware on every &lt;code&gt;npm run dev&lt;/code&gt;&lt;/a&gt;, I want an agent that runs unfamiliar code inside an OS boundary from the start. Claude Code can do this too with &lt;code&gt;/sandbox&lt;/code&gt;; it just doesn't start that way.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Safe scripting by default.&lt;/strong&gt; &lt;code&gt;codex exec&lt;/code&gt; starts in a read-only sandbox unless you pass &lt;code&gt;--sandbox workspace-write&lt;/code&gt;, and &lt;code&gt;--output-schema&lt;/code&gt; makes it return JSON that matches a schema you give it (&lt;a href="https://learn.chatgpt.com/docs/non-interactive-mode" rel="noopener noreferrer"&gt;non-interactive mode&lt;/a&gt;). That makes it a good fit for CI jobs like triage reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Quiet PR reviews.&lt;/strong&gt; On GitHub, Codex flags only P0 and P1 issues (&lt;a href="https://learn.chatgpt.com/docs/third-party/github" rel="noopener noreferrer"&gt;Codex GitHub docs&lt;/a&gt;). Reviews with less noise are reviews people actually read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A cheap way in for teams already on ChatGPT.&lt;/strong&gt; Every ChatGPT plan from Free upward includes Codex, and Business costs $25 per user per month billed monthly (&lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;Codex pricing&lt;/a&gt;). If a client's team already pays for ChatGPT Business, trying Codex costs them nothing extra.&lt;/p&gt;

&lt;h2&gt;
  
  
  One AGENTS.md for both agents
&lt;/h2&gt;

&lt;p&gt;The fastest way to get inconsistent code from two agents is to give them two sets of rules. You don't need two copies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Codex reads &lt;code&gt;AGENTS.md&lt;/code&gt; files from the repo root down to your working folder, one file per folder. Files closer to you override earlier ones, and the combined size caps at 32 KiB by default (&lt;a href="https://learn.chatgpt.com/docs/agent-configuration/agents-md" rel="noopener noreferrer"&gt;Codex AGENTS.md docs&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Claude Code reads &lt;code&gt;AGENTS.md&lt;/code&gt; when there is no &lt;code&gt;CLAUDE.md&lt;/code&gt;. If both exist, it reads &lt;strong&gt;only&lt;/strong&gt; &lt;code&gt;CLAUDE.md&lt;/code&gt;, unless &lt;code&gt;CLAUDE.md&lt;/code&gt; imports the other file (&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;Claude Code memory docs&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That second rule is how most repos drift: someone adds a &lt;code&gt;CLAUDE.md&lt;/code&gt; and Claude quietly stops reading the shared rules. My setup keeps &lt;code&gt;AGENTS.md&lt;/code&gt; as the source of truth and makes &lt;code&gt;CLAUDE.md&lt;/code&gt; a thin wrapper.&lt;/p&gt;

&lt;p&gt;The shape of a good &lt;code&gt;AGENTS.md&lt;/code&gt; (commands, non-obvious conventions, "done means") is in &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;my habits post&lt;/a&gt;. The part that matters for two agents is a review section. Codex's GitHub reviews look for a &lt;code&gt;## Code Review Rules&lt;/code&gt; heading in the nearest &lt;code&gt;AGENTS.md&lt;/code&gt; (&lt;a href="https://learn.chatgpt.com/docs/third-party/github" rel="noopener noreferrer"&gt;Codex GitHub docs&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Code Review Rules&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Flag any API route that skips the auth middleware
&lt;span class="p"&gt;-&lt;/span&gt; Flag money math done in floats; amounts are integer cents
&lt;span class="p"&gt;-&lt;/span&gt; Flag new env vars that aren't added to src/env.ts
&lt;span class="p"&gt;-&lt;/span&gt; Ignore formatting and import order; the linter owns those
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the whole &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;@AGENTS.md

&lt;span class="gu"&gt;## Claude Code only&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; For schema changes, use the /db-migration skill instead of editing models by hand
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude reads the imported file first, then the lines below it (&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;memory docs&lt;/a&gt;). The import also works on older Claude Code versions that can't read &lt;code&gt;AGENTS.md&lt;/code&gt; directly. Claude's &lt;code&gt;/code-review&lt;/code&gt; follows your &lt;code&gt;CLAUDE.md&lt;/code&gt; (&lt;a href="https://code.claude.com/docs/en/code-review-local" rel="noopener noreferrer"&gt;docs&lt;/a&gt;), so with the import, both reviewers check the same rules.&lt;/p&gt;

&lt;h2&gt;
  
  
  The loop: one agent writes, the other reviews
&lt;/h2&gt;

&lt;p&gt;In the habits post I argued for reviewing in a fresh context. Here I go one step further and use a different vendor's model.&lt;/p&gt;

&lt;p&gt;The research reason: Panickssery, Bowman and Feng found that LLM evaluators recognise and favour their own outputs, and that the stronger the self-recognition, the stronger the bias (&lt;a href="https://arxiv.org/abs/2404.13076" rel="noopener noreferrer"&gt;arXiv 2404.13076&lt;/a&gt;). A 2025 follow-up complicates this. For stronger models, most of that self-preference turned out to be justified, because their answers really were better. The harmful kind persisted when the model was wrong, and "stronger models struggle more to recognize when they are wrong" (&lt;a href="https://arxiv.org/abs/2504.03846" rel="noopener noreferrer"&gt;arXiv 2504.03846&lt;/a&gt;). You need a review for exactly the times the writer is wrong. Neither paper tested coding agents reviewing diffs, so take this as a good reason to try the loop, not as proof that it works.&lt;/p&gt;

&lt;p&gt;My loop:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code writes&lt;/strong&gt; the feature on a branch, interactively, starting in plan mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cheap checks run first.&lt;/strong&gt; Typecheck and tests. An agent review is not a test suite, and I don't pay an agent to find type errors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codex reviews the branch&lt;/strong&gt; against &lt;code&gt;main&lt;/code&gt; without changing the working tree (&lt;a href="https://learn.chatgpt.com/docs/code-review" rel="noopener noreferrer"&gt;Codex code review&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The findings go back to Claude&lt;/strong&gt; with a triage prompt (below).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Swap roles&lt;/strong&gt; when Codex wrote the branch: Claude's &lt;code&gt;/code-review&lt;/code&gt; runs non-interactively with &lt;code&gt;claude -p&lt;/code&gt; (&lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;headless docs&lt;/a&gt;).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The script I keep in the repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/usr/bin/env bash&lt;/span&gt;
&lt;span class="c"&gt;# Usage: scripts/cross-review.sh [codex|claude] [base-branch]&lt;/span&gt;
&lt;span class="c"&gt;# Ask the agent that did NOT write this branch to review it. Neither command edits files.&lt;/span&gt;
&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-euo&lt;/span&gt; pipefail

&lt;span class="nv"&gt;reviewer&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;1&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;codex&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nv"&gt;base&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;2&lt;/span&gt;&lt;span class="k"&gt;:-&lt;/span&gt;&lt;span class="nv"&gt;main&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="c"&gt;# Cheap checks first; an agent review is not a test suite.&lt;/span&gt;
pnpm tsc &lt;span class="nt"&gt;--noEmit&lt;/span&gt;
pnpm vitest run

&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$reviewer&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="k"&gt;in
  &lt;/span&gt;codex&lt;span class="p"&gt;)&lt;/span&gt;
    codex review &lt;span class="nt"&gt;--base&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$base&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;;;&lt;/span&gt;
  claude&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c"&gt;# dontAsk denies anything that would need approval, so the review can read but not write.&lt;/span&gt;
    claude &lt;span class="nt"&gt;-p&lt;/span&gt; &lt;span class="s2"&gt;"/code-review &lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;base&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;...HEAD"&lt;/span&gt; &lt;span class="nt"&gt;--permission-mode&lt;/span&gt; dontAsk
    &lt;span class="p"&gt;;;&lt;/span&gt;
  &lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"reviewer must be codex or claude"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&amp;amp;2
    &lt;span class="nb"&gt;exit &lt;/span&gt;1
    &lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;codex review&lt;/code&gt; takes exactly one target: &lt;code&gt;--base&lt;/code&gt;, &lt;code&gt;--commit&lt;/code&gt;, &lt;code&gt;--uncommitted&lt;/code&gt;, or a custom prompt (&lt;a href="https://learn.chatgpt.com/docs/developer-commands?surface=cli" rel="noopener noreferrer"&gt;Codex CLI reference&lt;/a&gt;). On the Claude side, &lt;code&gt;dontAsk&lt;/code&gt; mode denies every call that would otherwise prompt, but reads and read-only commands still run (&lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;headless docs&lt;/a&gt;). Without &lt;code&gt;--fix&lt;/code&gt;, &lt;code&gt;/code-review&lt;/code&gt; only reports.&lt;/p&gt;

&lt;p&gt;The triage prompt I paste into the writing agent with the findings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Another reviewer flagged the issues below on this branch.
For each one, either fix it or reply in one line explaining why it is not a bug.
Don't change code the findings don't mention.
When you're done, run the typecheck and tests and show me the output.

&amp;lt;findings&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The "explain why it isn't a bug" clause is what makes this work. Without it, the writer accepts every finding and the code bloats. With it, I read a short list of rejections and make the call myself.&lt;/p&gt;

&lt;p&gt;On GitHub, the same idea applies at team scale. Claude's managed Code Review starts with an &lt;code&gt;@claude review&lt;/code&gt; comment (&lt;a href="https://code.claude.com/docs/en/code-review" rel="noopener noreferrer"&gt;Claude Code Review&lt;/a&gt;), and Codex starts with &lt;code&gt;@codex review&lt;/code&gt; (&lt;a href="https://learn.chatgpt.com/docs/third-party/github" rel="noopener noreferrer"&gt;Codex GitHub docs&lt;/a&gt;). Don't turn both on for every PR. That doubles the noise. Ask for a review from the agent that didn't write the PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which agent for which job
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Job&lt;/th&gt;
&lt;th&gt;My first pick&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Exploring code I don't know yet&lt;/td&gt;
&lt;td&gt;Claude Code in plan mode&lt;/td&gt;
&lt;td&gt;Reads and plans before any edit; &lt;code&gt;Shift+Tab&lt;/code&gt; to switch modes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Feature work I want to steer&lt;/td&gt;
&lt;td&gt;Claude Code&lt;/td&gt;
&lt;td&gt;Mode switching, hooks for hard rules, background review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Running an unfamiliar repo or script&lt;/td&gt;
&lt;td&gt;Codex&lt;/td&gt;
&lt;td&gt;OS-level sandbox from the first command&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CI jobs: triage, reports, lint fixes&lt;/td&gt;
&lt;td&gt;&lt;code&gt;codex exec&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read-only by default; schema-checked JSON output&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A well-scoped ticket I want back as a PR&lt;/td&gt;
&lt;td&gt;Either&lt;/td&gt;
&lt;td&gt;Both run tasks in the cloud: Codex Cloud and Claude Code on the web&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Second-opinion review&lt;/td&gt;
&lt;td&gt;Whichever didn't write it&lt;/td&gt;
&lt;td&gt;Different model, different blind spots&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Team PR review on GitHub&lt;/td&gt;
&lt;td&gt;The one you already pay for&lt;/td&gt;
&lt;td&gt;Claude Code Review needs a Team or Enterprise plan; Codex reviews run through the ChatGPT Codex connector&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  What running both costs
&lt;/h2&gt;

&lt;p&gt;At entry level, Claude Pro plus ChatGPT Plus comes to $40 per developer per month, or $37 with Claude billed annually (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;, &lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;Codex pricing&lt;/a&gt;). Heavy users hit limits sooner, and both vendors' next tier starts at $100 a month (&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;, &lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;Codex pricing&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The cost that matters more for client work is data. Running two agents means two vendors see the code. Codex Cloud and Claude Code on the web run on vendor infrastructure, and Claude's managed Code Review isn't available to organisations with Zero Data Retention enabled (&lt;a href="https://code.claude.com/docs/en/code-review" rel="noopener noreferrer"&gt;Claude Code Review&lt;/a&gt;). Check the client's contract before you add a second vendor, not after.&lt;/p&gt;

&lt;h2&gt;
  
  
  When I don't bother with two agents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small, obvious changes.&lt;/strong&gt; If I can describe the diff in one sentence, one agent and the test suite are enough.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No tests.&lt;/strong&gt; Two agents agreeing is not verification. In Stack Overflow's 2026 survey, 48% of respondents said they trust AI when they can easily validate its answers (&lt;a href="https://survey.stackoverflow.co/2026/ai" rel="noopener noreferrer"&gt;Stack Overflow 2026&lt;/a&gt;). Make validation easy first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code the client won't share with a second vendor.&lt;/strong&gt; Use one agent and a fresh-context review from that same vendor. My reading of the 2025 self-preference paper is that this gets you most of the benefit.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Pick one agent to drive and use the other as the reviewer. Keep &lt;code&gt;AGENTS.md&lt;/code&gt; as the single source of truth, run your tests before any agent review, and make the writing agent justify every finding it rejects.&lt;/p&gt;

&lt;p&gt;If you're planning a product and want it built with this kind of review loop, I build React/Next.js and Node.js products for clients. &lt;a href="https://papansarkar.com/contact/" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt;. To keep either agent accurate and cheap, start with &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;Use AI Coding Agents Like a Pro&lt;/a&gt;. If you're on Copilot, see &lt;a href="https://papansarkar.com/blog/using-ai-agents-in-vscode/" rel="noopener noreferrer"&gt;Using AI Agents in VS Code&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://survey.stackoverflow.co/2026/ai" rel="noopener noreferrer"&gt;Stack Overflow Developer Survey 2026: AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://constellationr.com/insights/news/openai-touts-broadening-codex-usage-5-million-weekly-active-users" rel="noopener noreferrer"&gt;Constellation Research: OpenAI touts broadening Codex usage with 5 million weekly active users&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/news/anthropic-raises-30-billion-series-g-funding-380-billion-post-money-valuation" rel="noopener noreferrer"&gt;Anthropic: Series G announcement (Claude Code run-rate revenue)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/openai/codex" rel="noopener noreferrer"&gt;GitHub: openai/codex&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://claude.com/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/pricing" rel="noopener noreferrer"&gt;Codex docs: Pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/overview" rel="noopener noreferrer"&gt;Claude Code docs: Overview&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/permission-modes" rel="noopener noreferrer"&gt;Claude Code docs: Permission modes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/memory" rel="noopener noreferrer"&gt;Claude Code docs: How Claude remembers your project (CLAUDE.md and AGENTS.md)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/headless" rel="noopener noreferrer"&gt;Claude Code docs: Run Claude Code programmatically&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/code-review-local" rel="noopener noreferrer"&gt;Claude Code docs: Review locally with /code-review&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/code-review" rel="noopener noreferrer"&gt;Claude Code docs: Code Review&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs" rel="noopener noreferrer"&gt;Codex docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/sandboxing" rel="noopener noreferrer"&gt;Codex docs: Sandboxing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/non-interactive-mode" rel="noopener noreferrer"&gt;Codex docs: Non-interactive mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/code-review" rel="noopener noreferrer"&gt;Codex docs: Code review&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/developer-commands?surface=cli" rel="noopener noreferrer"&gt;Codex docs: Command line options&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/third-party/github" rel="noopener noreferrer"&gt;Codex docs: Use Codex in GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/docs/agent-configuration/agents-md" rel="noopener noreferrer"&gt;Codex docs: Custom instructions with AGENTS.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2404.13076" rel="noopener noreferrer"&gt;Panickssery, Bowman and Feng: LLM Evaluators Recognize and Favor Their Own Generations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2504.03846" rel="noopener noreferrer"&gt;Chen et al.: Do LLM Evaluators Prefer Themselves for a Reason?&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/claude-code-vs-codex-use-both/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>Use AI Coding Agents Like a Pro: Fewer Tokens, Better Code</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Sun, 01 Nov 2026 11:07:32 +0000</pubDate>
      <link>https://dev.to/papansarkar101/use-ai-coding-agents-like-a-pro-fewer-tokens-better-code-4j36</link>
      <guid>https://dev.to/papansarkar101/use-ai-coding-agents-like-a-pro-fewer-tokens-better-code-4j36</guid>
      <description>&lt;p&gt;Most developers who complain that coding agents are expensive and sloppy are making the same mistake: they treat the agent like a chat window and let one session grow all day. In the &lt;a href="https://survey.stackoverflow.co/2025/ai" rel="noopener noreferrer"&gt;2025 Stack Overflow survey&lt;/a&gt;, 66% of developers named "AI solutions that are almost right, but not quite" as their top frustration. In my experience, "almost right" and "expensive" usually have the same root cause: too much of the wrong context.&lt;/p&gt;

&lt;p&gt;This post is the workflow I use across Claude Code, OpenAI Codex, Cursor and GitHub Copilot. It is tool-agnostic on purpose. If you want the VS Code setup walkthrough, I covered that in &lt;a href="https://papansarkar.com/blog/using-ai-agents-in-vscode/" rel="noopener noreferrer"&gt;Using AI Agents in VS Code&lt;/a&gt;. This one is about habits.&lt;/p&gt;

&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Context is the budget, not the prompt.&lt;/strong&gt; Every turn re-sends the whole conversation, so a bloated session costs more and gets dumber at the same time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One task per session.&lt;/strong&gt; Clear between unrelated tasks. After two failed corrections, start over with a better prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep your instruction file short.&lt;/strong&gt; AGENTS.md / CLAUDE.md should hold only what the agent can't figure out from the code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Give the agent a check it can run.&lt;/strong&gt; Tests, a build, a linter. Without one, you are the test suite.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push noisy work out of the main context.&lt;/strong&gt; Subagents, filtered command output, CLI tools instead of piles of MCP servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Match the model and reasoning effort to the task.&lt;/strong&gt; The biggest model on every typo fix is how bills explode.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why context is the whole game
&lt;/h2&gt;

&lt;p&gt;Three pieces of research explain almost every agent failure I see.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance drops as context grows.&lt;/strong&gt; Chroma tested 18 models and found that "performance grows increasingly unreliable as input length grows," even on simple retrieval tasks (&lt;a href="https://www.trychroma.com/research/context-rot" rel="noopener noreferrer"&gt;Chroma, Context Rot&lt;/a&gt;). In one test, models did much better on focused prompts of about 300 tokens than on the full 113k-token version (&lt;a href="https://www.trychroma.com/research/context-rot" rel="noopener noreferrer"&gt;Chroma&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Position matters.&lt;/strong&gt; The "Lost in the Middle" paper showed models use information at the start and end of a long context better than information buried in the middle (&lt;a href="https://arxiv.org/abs/2307.03172" rel="noopener noreferrer"&gt;Liu et al., TACL&lt;/a&gt;). Your carefully written rule from 90 minutes ago is now in the middle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tokens are an attention budget.&lt;/strong&gt; Anthropic's engineering team frames good context engineering as finding "the smallest possible set of high-signal tokens" that gets the result you want (&lt;a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents" rel="noopener noreferrer"&gt;Anthropic, Effective context engineering&lt;/a&gt;). Their Claude Code docs put it bluntly: the context window "is the most important resource to manage" (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Claude Code best practices&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The cost side follows directly. Claude Code "sends your full conversation with every request," so a one-line question in a session open all day still pays for the whole history (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;). Prompt caching softens this, since cache reads bill at a fraction of the normal input price (&lt;a href="https://platform.claude.com/docs/en/build-with-claude/prompt-caching" rel="noopener noreferrer"&gt;Anthropic prompt caching&lt;/a&gt;), but the cache has a lifetime. Come back after a break and you pay to reprocess everything.&lt;/p&gt;

&lt;p&gt;Simple arithmetic: asking the same question in a fresh 20k-token session versus a stale 150k-token session is 7.5x the input tokens, and the stale session is more likely to answer wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Do agents actually make you faster?
&lt;/h2&gt;

&lt;p&gt;Short answer: yes for most people now, but not automatically. Here is the honest picture.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;METR's randomised trial found experienced open-source developers took 19% longer with early-2025 AI tools, while believing they were 20% faster (&lt;a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/" rel="noopener noreferrer"&gt;METR, July 2025&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;METR's follow-up says that result is now outdated and speedups "seem likely," but its new data is too biased by developers refusing to work without AI to give a reliable number (&lt;a href="https://metr.org/blog/2026-02-24-uplift-update/" rel="noopener noreferrer"&gt;METR, February 2026&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Google's DORA 2025 report calls AI "an amplifier" of a team's existing strengths and weaknesses (&lt;a href="https://dora.dev/research/2025/dora-report/" rel="noopener noreferrer"&gt;DORA 2025&lt;/a&gt;). Throughput went up, but delivery instability kept rising (&lt;a href="https://www.infoq.com/news/2025/09/dora-state-of-ai-in-dev-2025" rel="noopener noreferrer"&gt;InfoQ on DORA 2025&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Trust is still low: 46% of developers distrust AI accuracy and only 33% trust it (&lt;a href="https://survey.stackoverflow.co/2025/ai" rel="noopener noreferrer"&gt;Stack Overflow 2025&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My read: the gap between "agent made me slower" and "agent made me faster" is mostly workflow. The habits below are what close it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 1: Keep the instruction file short and boring
&lt;/h2&gt;

&lt;p&gt;Every agent now reads a project instruction file: &lt;code&gt;CLAUDE.md&lt;/code&gt; for Claude Code, &lt;code&gt;AGENTS.md&lt;/code&gt; for Codex, Cursor and many others, &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt; for Copilot. AGENTS.md has become the shared format, now stewarded by the Agentic AI Foundation under the Linux Foundation (&lt;a href="https://agents.md/" rel="noopener noreferrer"&gt;agents.md&lt;/a&gt;), and Copilot reads AGENTS.md and CLAUDE.md as well (&lt;a href="https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions" rel="noopener noreferrer"&gt;GitHub Docs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;This file loads on every session, so every line is a recurring tax. All the vendors say the same thing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Anthropic: "Aim to keep CLAUDE.md under 200 lines," and "Bloated CLAUDE.md files cause Claude to ignore your actual instructions!" (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;, &lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;OpenAI: "A short, accurate AGENTS.md is more useful than a long file full of vague rules" (&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;Codex best practices&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Cursor: "Start simple. Add rules only when you notice Agent making the same mistake repeatedly" (&lt;a href="https://cursor.com/docs/context/rules" rel="noopener noreferrer"&gt;Cursor rules&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The test for every line: would removing it cause a mistake? If not, cut it. Here is the shape I use for a Next.js + Node project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# AGENTS.md&lt;/span&gt;

&lt;span class="gu"&gt;## Commands&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Install: pnpm install
&lt;span class="p"&gt;-&lt;/span&gt; Dev: pnpm dev
&lt;span class="p"&gt;-&lt;/span&gt; Test one file: pnpm vitest run path/to/file.test.ts
&lt;span class="p"&gt;-&lt;/span&gt; Typecheck: pnpm tsc --noEmit
&lt;span class="p"&gt;-&lt;/span&gt; Lint: pnpm lint

&lt;span class="gu"&gt;## Conventions the code won't tell you&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Server actions live in app/(actions)/, never inside components
&lt;span class="p"&gt;-&lt;/span&gt; All DB access goes through lib/db/&lt;span class="err"&gt;*&lt;/span&gt;.ts; no raw queries in routes
&lt;span class="p"&gt;-&lt;/span&gt; Money is stored as integer paise, never floats

&lt;span class="gu"&gt;## Don't&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Don't edit files in migrations/ by hand; generate them
&lt;span class="p"&gt;-&lt;/span&gt; Don't add dependencies without asking

&lt;span class="gu"&gt;## Done means&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Typecheck, lint and the relevant tests pass
&lt;span class="p"&gt;-&lt;/span&gt; Show me the command output, not a summary of it
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No "write clean code," no folder-by-folder tour, no API docs pasted in. The agent can read the code. Put workflow-specific knowledge (how to do a release, how to write a migration) in on-demand files: skills in Claude Code, "Apply Intelligently" or file-scoped rules in Cursor, task-specific markdown files referenced from AGENTS.md in Codex. Those load only when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 2: One task, one session
&lt;/h2&gt;

&lt;p&gt;The most expensive pattern is what Anthropic calls "the kitchen sink session": you start one task, ask something unrelated, then go back (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;). OpenAI says the same: "Keep one chat per coherent unit of work," because long single-project chats lead to "bloated context and worse results over time" (&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;Codex best practices&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;My rules:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;New task, new session.&lt;/strong&gt; In Claude Code, &lt;code&gt;/clear&lt;/code&gt; costs nothing, while &lt;code&gt;/compact&lt;/code&gt; reads the whole conversation to summarise it, so it is itself a large request (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two strikes and restart.&lt;/strong&gt; If I've corrected the agent twice on the same thing, the context is full of failed attempts. I clear and write a better first prompt that includes what I learned. Anthropic recommends exactly this (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compact with instructions when you must keep going.&lt;/strong&gt; &lt;code&gt;/compact Focus on the API changes and the failing test&lt;/code&gt; keeps what matters instead of a generic summary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Side questions go elsewhere.&lt;/strong&gt; A quick "what does this flag do?" in the middle of a feature pollutes the context. Ask it in a separate window.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Habit 3: Plan only when the plan is worth it
&lt;/h2&gt;

&lt;p&gt;Planning prevents the most expensive failure: a correct implementation of the wrong thing. Both Claude Code and Codex have a plan mode (&lt;code&gt;Shift+Tab&lt;/code&gt;, or &lt;code&gt;/plan&lt;/code&gt; in Codex) (&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;Codex best practices&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;But planning costs tokens too. Anthropic's rule of thumb is the best one I know: "If you could describe the diff in one sentence, skip the plan" (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Use a plan when the change touches several files, when you're unsure of the approach, or when you don't know this part of the codebase. For larger features, flip it around: have the agent interview you, write a &lt;code&gt;SPEC.md&lt;/code&gt;, then start a &lt;strong&gt;fresh&lt;/strong&gt; session to implement from the spec. The implementation session starts clean with a written contract instead of 40 turns of back-and-forth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 4: Write prompts with a "done when"
&lt;/h2&gt;

&lt;p&gt;Vague prompts cause broad scanning, and scanning burns tokens. "Improve this codebase" makes the agent read everything; "add input validation to the login function in auth.ts" doesn't (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;OpenAI's Codex guide recommends four parts: goal, context, constraints, and a "Done when" condition (&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;Codex best practices&lt;/a&gt;). My template:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Goal: Users get logged out after a session timeout instead of a silent token refresh.
Context: Auth flow is in src/auth/. Token refresh is in src/auth/refresh.ts.
         Follow the error-handling pattern in src/auth/login.ts.
Constraints: No new dependencies. Don't change the public API of useSession().
Done when: A failing test reproduces the bug, the fix makes it pass,
           and `pnpm vitest run src/auth` plus `pnpm tsc --noEmit` are green.
           Paste the output.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pointing to files with paths (or &lt;code&gt;@file&lt;/code&gt; in Claude Code and Cursor) saves the agent from searching. Pointing to an existing pattern ("follow login.ts") gets you code that looks like the rest of your codebase instead of a generic tutorial.&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 5: Give the agent a check it can run
&lt;/h2&gt;

&lt;p&gt;This is the single biggest quality lever. An agent "stops when the work looks done," and without a check it can run, you become the verification loop (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;). With a test, build or linter, the agent runs it, reads the failure, and fixes it before you ever see the diff.&lt;/p&gt;

&lt;p&gt;Three rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ask for evidence, not claims.&lt;/strong&gt; "Show the test output" beats "it should work now."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run one test, not the suite.&lt;/strong&gt; A full test run dumps thousands of lines of passing output into context. Point the agent at the relevant file.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make the check deterministic when it matters.&lt;/strong&gt; Claude Code hooks and Stop hooks run a script every time, unlike instructions in CLAUDE.md, which are advisory (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Habit 6: Keep noisy work out of the main context
&lt;/h2&gt;

&lt;p&gt;Logs, test output, documentation pages and codebase exploration are the biggest context fillers. Three ways to keep them out:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Subagents for investigation.&lt;/strong&gt; A subagent explores in its own context window and returns a summary, often 1,000-2,000 tokens (&lt;a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents" rel="noopener noreferrer"&gt;Anthropic, Effective context engineering&lt;/a&gt;). "Use a subagent to find how we handle token refresh and whether we already have OAuth utilities" keeps 30 file reads out of your implementation session. Note that subagents still cost tokens; they save &lt;em&gt;context&lt;/em&gt;, and you can put them on a cheaper model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Filter output before the agent sees it.&lt;/strong&gt; Anthropic's example is a hook that greps a 10,000-line log for errors so the agent reads hundreds of tokens instead of tens of thousands (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;). Even without hooks, you can just ask for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Instead of letting the agent read the whole run:&lt;/span&gt;
pnpm vitest run 2&amp;gt;&amp;amp;1 | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; 5 &lt;span class="s1"&gt;'(FAIL|Error)'&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-80&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Prefer CLI tools over stacks of MCP servers.&lt;/strong&gt; Anthropic's own measurements show loading tool definitions and passing intermediate results through the model can be brutal: one workflow went from 150,000 tokens to 2,000 when the agent wrote code to call tools instead (&lt;a href="https://www.anthropic.com/engineering/code-execution-with-mcp" rel="noopener noreferrer"&gt;Anthropic, Code execution with MCP&lt;/a&gt;). Claude Code now defers MCP tool definitions by default, but its docs still say CLIs like &lt;code&gt;gh&lt;/code&gt;, &lt;code&gt;aws&lt;/code&gt; and &lt;code&gt;gcloud&lt;/code&gt; "are still more context-efficient than MCP servers" (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;). Disable servers you aren't using in this task.&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 7: Match the model and effort to the task
&lt;/h2&gt;

&lt;p&gt;Running the largest model at maximum reasoning on a rename is the fastest way to burn a budget. Prices differ a lot: on Anthropic's current list, Opus 5.5 output costs twice what Sonnet 5.5 does (&lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;), and Haiku 5.5 is far cheaper again (&lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Claude pricing&lt;/a&gt;). Thinking tokens are billed as output tokens (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;How I split it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task&lt;/th&gt;
&lt;th&gt;Model tier&lt;/th&gt;
&lt;th&gt;Reasoning effort&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rename, typo, add a log line, small CRUD endpoint&lt;/td&gt;
&lt;td&gt;Mid or small&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Feature across 3-6 files with tests&lt;/td&gt;
&lt;td&gt;Mid&lt;/td&gt;
&lt;td&gt;Medium&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Debugging a flaky race condition, architecture change&lt;/td&gt;
&lt;td&gt;Top&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Subagent doing file search or log summarising&lt;/td&gt;
&lt;td&gt;Small&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;OpenAI's Codex guidance lines up: low effort "for faster, well-scoped tasks," medium or high "for more complex changes or debugging," extra high for long, reasoning-heavy work (&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;Codex best practices&lt;/a&gt;). In Claude Code, &lt;code&gt;/model&lt;/code&gt; and &lt;code&gt;/effort&lt;/code&gt; switch both mid-session (&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code costs&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  Habit 8: Review with fresh eyes
&lt;/h2&gt;

&lt;p&gt;An agent reviewing code it just wrote is biased toward its own reasoning. A reviewer in a fresh context sees only the diff and your criteria (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;). I use a second session or subagent with a narrow brief: "Review this diff against SPEC.md. Report only gaps that affect correctness or stated requirements."&lt;/p&gt;

&lt;p&gt;That last sentence matters. A reviewer asked to find problems will always find some, and chasing every nitpick leads to over-engineered code (&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;best practices&lt;/a&gt;).&lt;/p&gt;

&lt;h2&gt;
  
  
  The token-waste cheat sheet
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Likely cause&lt;/th&gt;
&lt;th&gt;Fix&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Agent ignores a rule you wrote&lt;/td&gt;
&lt;td&gt;Instruction file too long; rule lost in noise&lt;/td&gt;
&lt;td&gt;Prune to essentials; move workflows to on-demand skills or rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Usage spikes on a simple question&lt;/td&gt;
&lt;td&gt;Session open for hours&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/clear&lt;/code&gt; or a new chat per task&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Same mistake after corrections&lt;/td&gt;
&lt;td&gt;Context full of failed attempts&lt;/td&gt;
&lt;td&gt;Restart with a better first prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agent reads half the repo&lt;/td&gt;
&lt;td&gt;Vague prompt&lt;/td&gt;
&lt;td&gt;Name files, point to a pattern, add "done when"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Huge turns after running tests&lt;/td&gt;
&lt;td&gt;Full test output in context&lt;/td&gt;
&lt;td&gt;Run one file; filter to failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Slow, pricey answers on easy tasks&lt;/td&gt;
&lt;td&gt;Top model and max effort by default&lt;/td&gt;
&lt;td&gt;Drop model tier and effort&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"It works" but it doesn't&lt;/td&gt;
&lt;td&gt;No runnable check&lt;/td&gt;
&lt;td&gt;Require test or build output as evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  When not to reach for an agent
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You can't verify the result.&lt;/strong&gt; If there's no test, no type system and no way to run it, a plausible diff is a liability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The change is two lines you already know.&lt;/strong&gt; Typing it is faster than writing the prompt.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The task is mostly a judgment call.&lt;/strong&gt; Pricing logic, security boundaries, data deletion. Use the agent to explore options, then decide yourself.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The short version
&lt;/h2&gt;

&lt;p&gt;Treat the agent like a strong engineer who forgets everything between sessions: short onboarding doc, one clear task, a definition of done, a test to run, and a fresh pair of eyes at the end. That is what uses fewer tokens, and it is also what produces code you can ship.&lt;/p&gt;

&lt;p&gt;If you're planning a product and want someone who builds this way, I ship React/Next.js and Node.js products with AI in the loop for clients. &lt;a href="https://papansarkar.com/contact/" rel="noopener noreferrer"&gt;Get in touch&lt;/a&gt;. If you're wiring LLMs into your own backend, start with my &lt;a href="https://papansarkar.com/blog/llm-integration-django-backend/" rel="noopener noreferrer"&gt;LLM integration guide&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://survey.stackoverflow.co/2025/ai" rel="noopener noreferrer"&gt;Stack Overflow Developer Survey 2025: AI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.trychroma.com/research/context-rot" rel="noopener noreferrer"&gt;Chroma Research: Context Rot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://arxiv.org/abs/2307.03172" rel="noopener noreferrer"&gt;Liu et al., Lost in the Middle: How Language Models Use Long Contexts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents" rel="noopener noreferrer"&gt;Anthropic: Effective context engineering for AI agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/best-practices" rel="noopener noreferrer"&gt;Claude Code docs: Best practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://code.claude.com/docs/en/costs" rel="noopener noreferrer"&gt;Claude Code docs: Manage costs effectively&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/en/build-with-claude/prompt-caching" rel="noopener noreferrer"&gt;Anthropic docs: Prompt caching&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://platform.claude.com/docs/en/about-claude/pricing" rel="noopener noreferrer"&gt;Anthropic docs: Pricing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.anthropic.com/engineering/code-execution-with-mcp" rel="noopener noreferrer"&gt;Anthropic: Code execution with MCP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/" rel="noopener noreferrer"&gt;METR: Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://metr.org/blog/2026-02-24-uplift-update/" rel="noopener noreferrer"&gt;METR: We are Changing our Developer Productivity Experiment Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dora.dev/research/2025/dora-report/" rel="noopener noreferrer"&gt;DORA: 2025 State of AI-assisted Software Development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.infoq.com/news/2025/09/dora-state-of-ai-in-dev-2025" rel="noopener noreferrer"&gt;InfoQ: DORA 2025 report coverage&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://agents.md/" rel="noopener noreferrer"&gt;AGENTS.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.chatgpt.com/guides/best-practices" rel="noopener noreferrer"&gt;OpenAI Codex: Best practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cursor.com/docs/context/rules" rel="noopener noreferrer"&gt;Cursor docs: Rules&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions" rel="noopener noreferrer"&gt;GitHub Docs: Adding repository custom instructions for Copilot&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://papansarkar.com/blog/use-ai-coding-agents-like-a-pro/" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>coding</category>
      <category>productivity</category>
    </item>
    <item>
      <title>LLM Prices Just Dropped Up to 80%: How to Re-plan Your App's AI Costs</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Fri, 30 Oct 2026 12:55:41 +0000</pubDate>
      <link>https://dev.to/papansarkar101/llm-prices-just-dropped-up-to-80-how-to-re-plan-your-apps-ai-costs-3ck0</link>
      <guid>https://dev.to/papansarkar101/llm-prices-just-dropped-up-to-80-how-to-re-plan-your-apps-ai-costs-3ck0</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; OpenAI and Anthropic have cut LLM prices by up to 80% since July 2026. Before you celebrate, check which line of your bill actually moved. For agent-style workloads, cached input dominates spend, small models now handle most "AI feature" work for pennies, and the safest architecture is one that lets you switch models with a config change. Here's how I'd re-plan an app's AI costs this week.&lt;/p&gt;

&lt;h2&gt;
  
  
  What changed
&lt;/h2&gt;

&lt;p&gt;Max Woolf published a &lt;a href="https://minimaxir.com/2026/10/cheap-llms/" rel="noopener noreferrer"&gt;clear breakdown of the recent price cuts&lt;/a&gt; on 25 October. The short version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OpenAI's small "Luna" tier dropped about 80% in July, then halved again with GPT-6 Luna in September.&lt;/li&gt;
&lt;li&gt;Anthropic made a Sonnet 5 launch discount permanent, cut cache-read pricing hard on Fable 5.1, and cut Opus 5.5 by 40–60% overall compared to Opus 5.&lt;/li&gt;
&lt;li&gt;OpenAI's flagship "Sol" models got cheaper in steps through August and September, with GPT-6.1 Sol halving cache reads again.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;His explanation is competition: open-weight models and dozens of inference providers sell near-identical quality, so price is the lever left. Whatever the cause, it changes the maths for a lot of features that were "too expensive" in the spring.&lt;/p&gt;

&lt;p&gt;But the headline number hides the part that matters for your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Find out which tokens you're actually paying for
&lt;/h2&gt;

&lt;p&gt;Most of us look at the input and output price and stop there. The same write-up points out that in agentic coding, &lt;strong&gt;cache reads are 96–99% of token spend&lt;/strong&gt;. Agents re-send the same system prompt, tool definitions and file context on every turn, and almost all of it is a cache hit.&lt;/p&gt;

&lt;p&gt;So for an agent, a 75% cut on cache reads matters more than a 20% cut on output. For a one-shot summariser with no shared prefix, the reverse is true.&lt;/p&gt;

&lt;p&gt;Before deciding anything, split your usage into those buckets. Both major APIs return usage per request. A tiny logger is enough to start:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// usage-log.ts&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Usage&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;feature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;inputTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;outputTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cacheReadTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cacheWriteTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;logUsage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;u&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Usage&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Swap console for your DB or analytics later.&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;u&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;}));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Log it per &lt;em&gt;feature&lt;/em&gt;, not just per model. "The AI bill" is useless. "The ticket-triage feature costs X per 1,000 tickets" is something you can make decisions about.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Structure prompts so the cache actually hits
&lt;/h2&gt;

&lt;p&gt;If cache reads are now very cheap, the win is making sure your requests are cacheable in the first place. The rule is simple: &lt;strong&gt;stable content first, changing content last&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;With Anthropic's Messages API, you mark the end of the stable prefix with &lt;code&gt;cache_control&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Anthropic&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@anthropic-ai/sdk&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Anthropic&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;answerWithDocs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;question&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_MODEL&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// keep model IDs in config&lt;/span&gt;
    &lt;span class="na"&gt;max_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;system&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;You answer questions using only the provided docs.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;text&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;docs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// large, rarely changes -&amp;gt; cache it&lt;/span&gt;
        &lt;span class="na"&gt;cache_control&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ephemeral&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;messages&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;role&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;user&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;question&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt; &lt;span class="c1"&gt;// changes every call&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OpenAI applies prompt caching automatically on long prompts, but the same ordering rule applies: anything that changes per request (timestamps, user names, the question) belongs at the end. A single &lt;code&gt;Today is ${new Date()}&lt;/code&gt; at the top of your system prompt quietly breaks the cache for everything after it.&lt;/p&gt;

&lt;p&gt;Things that commonly bust the cache:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dynamic values in the system prompt&lt;/li&gt;
&lt;li&gt;Tool definitions generated in a different order each time&lt;/li&gt;
&lt;li&gt;Re-serialising JSON context with unstable key order&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Route by task, not by habit
&lt;/h2&gt;

&lt;p&gt;Lots of products send everything to the flagship model because that's what the prototype used. Now the small tiers cost cents per million tokens, so it's worth being deliberate.&lt;/p&gt;

&lt;p&gt;A simple router covers most apps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// llm-router.ts&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Task&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;classify&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;extract&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;summarize&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;reason&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;code&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MODEL_FOR&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;classify&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_SMALL&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;extract&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_SMALL&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_SMALL&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;reason&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_LARGE&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;code&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;LLM_LARGE&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;pickModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;MODEL_FOR&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then measure. Run a few hundred real inputs through the small model and compare with the large one on the cases you care about. If the small model is right often enough, ship it. If not, you've lost an afternoon, not a quarter.&lt;/p&gt;

&lt;p&gt;I'd keep one honest caveat here: cheaper models are not automatically good enough. A specialised, boring approach (a regex, a classic classifier, a database query) still beats an LLM for plenty of tasks. Price cuts don't change that.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Put the provider behind one function
&lt;/h2&gt;

&lt;p&gt;The other side of commoditisation: if quality is close and prices keep moving, switching providers becomes a normal operation. Make it cheap.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# llm.py
&lt;/span&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;

&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LLMResult&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;input_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;output_tokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&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;*&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task&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;LLMResult&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;LLM_PROVIDER&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;  &lt;span class="c1"&gt;# "anthropic" | "openai" | ...
&lt;/span&gt;    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;anthropic&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.providers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;anthropic_complete&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;anthropic_complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;provider&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;openai&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;.providers&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;openai_complete&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;openai_complete&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;raise&lt;/span&gt; &lt;span class="nc"&gt;ValueError&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Unknown provider: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing clever here, and that's the point. Your app code calls &lt;code&gt;complete()&lt;/code&gt;. Model IDs, providers and fallbacks live in config. When the next price change lands, you change an environment variable and re-run your evals.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Re-check the features you shelved
&lt;/h2&gt;

&lt;p&gt;This is where the price cuts can make actual product money. Go back through the AI ideas you dropped for cost and price each one at today's rates:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Which tier does it really need?&lt;/td&gt;
&lt;td&gt;Small-model pricing changes most features from "no" to "yes"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How much of the prompt is a stable prefix?&lt;/td&gt;
&lt;td&gt;Cheap cache reads reward long, shared context&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What does it cost per user per month?&lt;/td&gt;
&lt;td&gt;Compare against what that user pays you&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does it still work at 2x today's price?&lt;/td&gt;
&lt;td&gt;Prices can move in either direction&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;That last row is my rule of thumb. If a feature only makes sense at this quarter's prices, build it so you can swap models or switch it off without a migration. If it still makes sense at double the price, it's a real feature, so build it properly.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would not do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Don't jump to the most expensive model just because it's cheaper than last month.&lt;/strong&gt; Measure first. Bigger isn't always better for narrow tasks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't hard-code a model ID in twenty places.&lt;/strong&gt; You will want to change it, probably soon.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't assume subscription plans follow API prices.&lt;/strong&gt; Woolf notes he cut his own subscription quota, and he expects plan allowances may shrink before API prices rise.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Wrapping up
&lt;/h2&gt;

&lt;p&gt;The price cuts are real, and they make a lot of AI features newly viable. The developers who benefit most will be the ones who know which tokens they pay for, keep their prompts cache-friendly, and can switch models without a rewrite.&lt;/p&gt;

&lt;p&gt;Which line of your LLM bill surprised you most when you finally broke it down: input, output or cache?&lt;/p&gt;




&lt;p&gt;I build web and AI products for clients; more about my work at &lt;a href="https://papansarkar.com" rel="noopener noreferrer"&gt;papansarkar.com&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>llm</category>
      <category>openai</category>
      <category>ai</category>
    </item>
    <item>
      <title>8 Habits to Stop Burning Tokens with AI Coding Tools</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Sun, 25 Oct 2026 00:45:16 +0000</pubDate>
      <link>https://dev.to/papansarkar101/8-habits-to-stop-burning-tokens-with-ai-coding-tools-32f4</link>
      <guid>https://dev.to/papansarkar101/8-habits-to-stop-burning-tokens-with-ai-coding-tools-32f4</guid>
      <description>&lt;p&gt;Most developers burn AI tokens the same way they used to burn cloud credits: by not paying attention.&lt;/p&gt;

&lt;p&gt;Every message you send to an AI coding tool also sends the context with it: the earlier chat history, the files it has read, and the tool output. When usage grows, it's rarely because of one huge prompt. It's because of context piling up quietly in the background.&lt;/p&gt;

&lt;p&gt;Here are the habits that cut my usage the most without slowing me down.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. One task per session
&lt;/h2&gt;

&lt;p&gt;When a task is done, clear the context before you start the next one. A long chat re-sends old history with every turn, so you keep paying for a bug you fixed an hour ago.&lt;/p&gt;

&lt;p&gt;In Claude Code, &lt;code&gt;/clear&lt;/code&gt; does this. In other tools, just start a new chat.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Write a project rules file once
&lt;/h2&gt;

&lt;p&gt;Put your stack, conventions, folder layout, and common commands in a rules file: &lt;code&gt;CLAUDE.md&lt;/code&gt; for Claude Code, &lt;code&gt;.cursorrules&lt;/code&gt; or project rules for Cursor, or your tool's equivalent.&lt;/p&gt;

&lt;p&gt;Keep it short. It loads into every session, so a bloated rules file costs you tokens on every single request.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Point to files, don't paste them
&lt;/h2&gt;

&lt;p&gt;Compare these two prompts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Fix the null check in &lt;code&gt;auth/session.ts&lt;/code&gt; around line 40"&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;pastes three files&lt;/em&gt; "something's wrong with login"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first one gives the agent a target. The second one invites it to explore.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Plan first, then execute
&lt;/h2&gt;

&lt;p&gt;Ask for a short plan and approve it before the agent writes any code. Claude Code has a dedicated plan mode for this. A wrong direction caught at the plan stage costs a few hundred tokens. Caught after implementation, it costs you a full rewrite loop.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Match the model to the task
&lt;/h2&gt;

&lt;p&gt;Renames, boilerplate, test scaffolding, and formatting don't need your most expensive model. Switch to a smaller or faster model for routine work, and save the big one for architecture decisions and hard debugging.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Give precise errors, not vibes
&lt;/h2&gt;

&lt;p&gt;Paste the exact stack trace, the failing command, and what you expected to happen. "It's broken" makes the agent read through half your repo trying to reproduce the problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Keep noise out of reach
&lt;/h2&gt;

&lt;p&gt;Build output, lockfiles, generated code, and large fixtures waste context when they get read. Cursor supports &lt;code&gt;.cursorignore&lt;/code&gt;. In Claude Code, you can deny reads to specific paths in your settings permissions.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. Summarize, then reset
&lt;/h2&gt;

&lt;p&gt;When a session gets long but the work isn't finished, ask for a summary of the decisions made and the current state. Then start fresh and paste the summary in. Claude Code's &lt;code&gt;/compact&lt;/code&gt; does a version of this for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  The real point
&lt;/h2&gt;

&lt;p&gt;Token efficiency isn't about being cheap. It's about context hygiene. A clean, focused context is cheaper, and it also gives you better output, because the model isn't sorting through stale or irrelevant information.&lt;/p&gt;

&lt;p&gt;What's your biggest token-waster? Let me know in the comments.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>coding</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>How a Clean Next.js Repo Ran Malware on Every npm run dev</title>
      <dc:creator>Papan Sarkar</dc:creator>
      <pubDate>Tue, 20 Oct 2026 21:44:19 +0000</pubDate>
      <link>https://dev.to/papansarkar101/the-npm-malware-hiding-in-tailwindconfigjs-1lmm</link>
      <guid>https://dev.to/papansarkar101/the-npm-malware-hiding-in-tailwindconfigjs-1lmm</guid>
      <description>&lt;p&gt;A codebase I got through Fiverr looked like an ordinary Next.js invoice app. It wasn't.&lt;/p&gt;

&lt;p&gt;Two dependencies deep, gated behind an npm auth token committed in the project's own &lt;code&gt;.npmrc&lt;/code&gt;, sat a private package carrying roughly 180 KB of heavily obfuscated JavaScript — wired to execute every time the dev server starts.&lt;/p&gt;

&lt;p&gt;I caught it before running it. Here is the short version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Every standard check passed
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;package.json&lt;/code&gt; scripts held only &lt;code&gt;dev&lt;/code&gt;, &lt;code&gt;build&lt;/code&gt;, &lt;code&gt;start&lt;/code&gt; and &lt;code&gt;lint&lt;/code&gt;. No &lt;code&gt;preinstall&lt;/code&gt;, no &lt;code&gt;postinstall&lt;/code&gt;, no &lt;code&gt;prepare&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A grep for the usual suspects came back empty:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-rnE&lt;/span&gt; &lt;span class="s2"&gt;"eval&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|new Function|child_process|execSync|spawn&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|atob&lt;/span&gt;&lt;span class="se"&gt;\(&lt;/span&gt;&lt;span class="s2"&gt;|fromCharCode|base64"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.js &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.mjs &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.cjs &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.ts &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.jsx &lt;span class="nt"&gt;--include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.tsx &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; node_modules
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A long-line grep, which is how whitespace-padded payloads usually surface, matched only SVG path data and Tailwind class strings.&lt;/p&gt;

&lt;p&gt;The repo &lt;em&gt;was&lt;/em&gt; clean. The malicious code was never in it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things that didn't add up
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The project shipped an npm auth token.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .npmrc
//registry.npmjs.org/:_authToken&lt;span class="o"&gt;=&lt;/span&gt;npm_HIswo…[redacted]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An npm access token carries &lt;a href="https://docs.npmjs.com/about-access-tokens" rel="noopener noreferrer"&gt;"the right to install and/or publish your modules"&lt;/a&gt;, including read access to private packages that account can see. A stranger's deliverable has no reason to include one. Its only function here was to let &lt;code&gt;npm install&lt;/code&gt; fetch something you otherwise could not.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. A Tailwind plugin I'd never heard of.&lt;/strong&gt; &lt;code&gt;devDependencies&lt;/code&gt; had &lt;code&gt;"tailwind-animationlab": "^2.0.6"&lt;/code&gt;. The real ones cluster around similar names — &lt;code&gt;tailwindcss-animate&lt;/code&gt;, &lt;code&gt;tailwindcss-animated&lt;/code&gt;, &lt;code&gt;tailwind-animations&lt;/code&gt;. At the bottom of &lt;code&gt;tailwind.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tailwind-animationlab&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)({&lt;/span&gt;
    &lt;span class="na"&gt;duration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;500ms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;1s&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;iterationCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;],&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing about that looks wrong — and that's the point. &lt;a href="https://v3.tailwindcss.com/docs/configuration" rel="noopener noreferrer"&gt;Tailwind's own docs&lt;/a&gt; register plugins exactly this way, with &lt;code&gt;require()&lt;/code&gt; inside the &lt;code&gt;plugins&lt;/code&gt; array. The config file was padded with friendly comments explaining unused theme values, which made one more &lt;code&gt;require&lt;/code&gt; easy to skim past.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The timestamps.&lt;/strong&gt; Nearly every file was dated Sep 13, 13:29. Three were not: &lt;code&gt;.npmrc&lt;/code&gt; (Sep 13, 14:15), &lt;code&gt;tailwind.config.js&lt;/code&gt; (Sep 28, 09:49), &lt;code&gt;package.json&lt;/code&gt; (Sep 28, 09:50). Exactly the three files needed to authorize, inject and execute a dependency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Following the chain
&lt;/h2&gt;

&lt;p&gt;From my home directory, so the project's token wasn't picked up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~ &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npm view tailwind-animationlab
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One version, numbered 2.0.6 — new packages don't start at 2.0.6; it was chosen to satisfy the &lt;code&gt;^2.0.6&lt;/code&gt; already in the project. Registry creation date 2026-09-28, the same day those config files were edited. npm maintainer &lt;code&gt;adriannamrr&lt;/code&gt;, but author and homepage pointing at &lt;code&gt;sericpieap&lt;/code&gt;. And one dependency I didn't recognise: &lt;code&gt;@jasperquinn/postcss-motion-helpers&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I unpacked the decoy without executing it. Clean. It was built to survive a code review, because that's the layer a careful developer actually inspects.&lt;/p&gt;

&lt;p&gt;Then:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm view @jasperquinn/postcss-motion-helpers
&lt;span class="c"&gt;# npm error 404 Not Found&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;strong&gt;public&lt;/strong&gt; package depending on a &lt;strong&gt;private&lt;/strong&gt; one. Private npm packages &lt;a href="https://docs.npmjs.com/about-private-packages" rel="noopener noreferrer"&gt;"always have a scope"&lt;/a&gt; and are readable only by the owner and granted collaborators. So for anyone else on earth, installing &lt;code&gt;tailwind-animationlab&lt;/code&gt; fails. It resolves only on a machine holding the attacker's token — which is to say, on a victim's machine, supplied through that &lt;code&gt;.npmrc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With the token, inside a throwaway Codespace on a burner GitHub account, still executing nothing, the private tarball's &lt;code&gt;src/config.js&lt;/code&gt; was a wall of machine-generated obfuscation: an encoded blob, &lt;code&gt;_0x&lt;/code&gt; hex identifiers, a large &lt;code&gt;switch&lt;/code&gt;-based dispatch loop, heavy &lt;code&gt;Proxy&lt;/code&gt; and &lt;code&gt;Reflect&lt;/code&gt; use. A PostCSS helper has no reason to look like that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why &lt;code&gt;--ignore-scripts&lt;/code&gt; wouldn't have helped
&lt;/h2&gt;

&lt;p&gt;Most npm hardening advice is about install hooks. But npm's config reference is explicit that &lt;code&gt;npm run&lt;/code&gt; and &lt;code&gt;npm start&lt;/code&gt; &lt;a href="https://docs.npmjs.com/cli/v11/using-npm/config" rel="noopener noreferrer"&gt;"will still run their intended script if &lt;code&gt;ignore-scripts&lt;/code&gt; is set"&lt;/a&gt; — they only skip pre- and post-scripts.&lt;/p&gt;

&lt;p&gt;This attack never wanted an install hook. Tailwind v3 loads &lt;code&gt;tailwind.config.js&lt;/code&gt; whenever it generates CSS, so that &lt;code&gt;require()&lt;/code&gt; evaluates on every &lt;code&gt;npm run dev&lt;/code&gt; and every &lt;code&gt;npm run build&lt;/code&gt;. The trigger was the developer doing their job.&lt;/p&gt;

&lt;p&gt;Same logic covers a neighbouring trick: VS Code's &lt;code&gt;runOn: folderOpen&lt;/code&gt; means &lt;a href="https://code.visualstudio.com/docs/debugtest/tasks" rel="noopener noreferrer"&gt;"the task will be run when the containing folder is opened"&lt;/a&gt;. Clicking &lt;em&gt;Trust&lt;/em&gt; on a stranger's folder is a code-execution decision.&lt;/p&gt;

&lt;h2&gt;
  
  
  Is this a known campaign?
&lt;/h2&gt;

&lt;p&gt;The tradecraft matches Contagious Interview. Socket counted more than 338 malicious npm packages with over 50,000 cumulative downloads in a single wave, tied to more than 180 fake maintainer personas, attributed to &lt;a href="https://socket.dev/blog/north-korea-contagious-interview-campaign-338-malicious-npm-packages" rel="noopener noreferrer"&gt;"North Korean state-sponsored actors"&lt;/a&gt; — and its package list includes names impersonating &lt;code&gt;tailwindcss&lt;/code&gt;, &lt;code&gt;vite&lt;/code&gt;, &lt;code&gt;eslint&lt;/code&gt; and &lt;code&gt;next&lt;/code&gt;. &lt;a href="https://www.elastic.co/security-labs/threat-command/contagious-interview-malware-svg-steganography" rel="noopener noreferrer"&gt;Elastic documented&lt;/a&gt; a tampered Next.js e-commerce template carrying a credential and wallet stealer plus a Socket.IO RAT.&lt;/p&gt;

&lt;p&gt;To be precise: &lt;strong&gt;I have not confirmed this sample is Contagious Interview.&lt;/strong&gt; My delivery channel was a paid Fiverr gig, not a fake job interview, and I didn't reverse the payload. What matches is the playbook.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I check now
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ls -la&lt;/code&gt; — &lt;code&gt;.npmrc&lt;/code&gt; with an &lt;code&gt;_authToken&lt;/code&gt;, a custom &lt;code&gt;registry=&lt;/code&gt;, a &lt;code&gt;.vscode/tasks.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;scripts&lt;/code&gt; in &lt;em&gt;every&lt;/em&gt; &lt;code&gt;package.json&lt;/code&gt;, not just the root one&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;*.config.js&lt;/code&gt; for Tailwind, PostCSS, Next, ESLint, Vite — any &lt;code&gt;require()&lt;/code&gt; you don't recognise&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm view &amp;lt;pkg&amp;gt;&lt;/code&gt; run from &lt;code&gt;~&lt;/code&gt;: single version, starting at 2.x+, published recently, maintainer ≠ author&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm view &amp;lt;pkg&amp;gt; dependencies&lt;/code&gt;: unknown scoped packages, or a 404 on the public registry&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ls -la&lt;/code&gt; again, for a handful of config files edited separately from everything else&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two rules carry most of the weight: &lt;strong&gt;read unknown code in a disposable environment with no real credentials&lt;/strong&gt;, and &lt;strong&gt;treat any &lt;code&gt;.npmrc&lt;/code&gt; you didn't write as hostile&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Status as of writing
&lt;/h2&gt;

&lt;p&gt;I reported both packages and both maintainer accounts to npm, the seller to Fiverr, and the GitHub account to GitHub. The &lt;code&gt;sericpieap&lt;/code&gt; GitHub account and its homepage now return 404. But &lt;code&gt;tailwind-animationlab@2.0.6&lt;/code&gt; is still installable from the public registry, and &lt;code&gt;@jasperquinn/postcss-motion-helpers&lt;/code&gt; still 404s publicly — the delivery mechanism is intact.&lt;/p&gt;

&lt;p&gt;Indicators: &lt;code&gt;tailwind-animationlab@2.0.6&lt;/code&gt;, shasum &lt;code&gt;9636e080056e59024e3e0d70f998d8f80e9129a9&lt;/code&gt;, maintainer &lt;code&gt;adriannamrr&lt;/code&gt;, author/homepage &lt;code&gt;sericpieap&lt;/code&gt;, created 2026-09-28. Private dependency &lt;code&gt;@jasperquinn/postcss-motion-helpers@1.0.3&lt;/code&gt;, referenced as &lt;code&gt;^1.0.1&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;If you've seen these package names in a dataset, I'd like to hear about it.&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>javascript</category>
      <category>node</category>
      <category>security</category>
    </item>
  </channel>
</rss>
