<?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: Lukas Kopischke</title>
    <description>The latest articles on DEV Community by Lukas Kopischke (@lnk1812).</description>
    <link>https://dev.to/lnk1812</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%2F4261037%2Fc0474bb8-32c5-43a6-b226-894277be2b97.png</url>
      <title>DEV Community: Lukas Kopischke</title>
      <link>https://dev.to/lnk1812</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lnk1812"/>
    <language>en</language>
    <item>
      <title>Browser LLMs in PWAs – Field Test, Storage Silos and the 400 MB Hurdle</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:43:45 +0000</pubDate>
      <link>https://dev.to/lnk1812/browser-llms-in-pwas-field-test-storage-silos-and-the-400-mb-hurdle-46le</link>
      <guid>https://dev.to/lnk1812/browser-llms-in-pwas-field-test-storage-silos-and-the-400-mb-hurdle-46le</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/browser-llms" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You are engineering a Progressive Web App and want to deliver on the promise of offline on-device AI: zero cloud latency, zero server bills, and absolute privacy on client devices. But the initial field test delivers a harsh reality check: a 480-megabyte download for even the smallest coherent model, thermal throttling, and answers that crumble on basic reasoning tasks. Why is there such a massive gulf between WebGPU demo hype and real-world production viability?&lt;/p&gt;

&lt;p&gt;Local language models in PWAs fail in practice due to three architectural and physical barriers: the web’s Same-Origin isolation that duplicates model weights per origin, the 400-megabyte minimum threshold for multilingual utility, and the total lack of standardized native browser APIs on mobile devices. While vector embeddings at 25 megabytes work reliably offline, generative in-browser chat models remain an expensive storage and user-experience antipattern for mobile PWAs.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz:&lt;/strong&gt;&lt;br&gt;
Browser sandboxing isolates model weights per origin: Without a shared platform API, every installed PWA downloads identical gigabyte-sized files.&lt;br&gt;
  For mobile web apps, in-browser LLM inference is currently a storage and retention trap.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Does the Vision Collide with the Web's Storage Architecture?
&lt;/h2&gt;

&lt;p&gt;The foundational security model of the modern web is the Same-Origin Policy (A browser security mechanism that prevents scripts on one origin from accessing storage, cookies, or databases of another origin.). Every web application runs inside an isolated sandbox. While essential for credential security, this sandbox turns into an architectural disaster when handling multi-hundred-megabyte weight files:&lt;/p&gt;

&lt;p&gt;When a user installs three separate Progressive Web Apps (PWAs) (Web applications built with modern browser APIs that can be installed to the home screen and function offline via Service Workers.), each offering an on-device chatbot or offline assistant, no app can read or share the model cache of its neighbor.&lt;/p&gt;

&lt;h3&gt;
  
  
  Origin Isolation: The Multi-App Storage Trap
&lt;/h3&gt;

&lt;p&gt;On native operating systems, applications share common shared libraries or query a single operating-system neural engine (such as Apple Intelligence or Windows Copilot Runtime). The web platform lacks this shared tier entirely:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Origin A (&lt;code&gt;notes-app.dev&lt;/code&gt;)&lt;/strong&gt; downloads a quantized Qwen model (483 MB) into its private Cache Storage API (A browser API for storing network request/response pairs persistently, typically managed by a Service Worker.).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Origin B (&lt;code&gt;lukiluki.me&lt;/code&gt;)&lt;/strong&gt; downloads the exact same 483 MB binary weights into its own isolated origin cache.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Origin C (&lt;code&gt;task-tracker.app&lt;/code&gt;)&lt;/strong&gt; downloads the weights a third time.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Across three installed PWAs, identical tensor matrices consume nearly 1.5 gigabytes of flash storage on the client device. On smartphones where users constantly juggle storage limits for photos, operating-system updates, and videos, this uncoordinated footprint triggers immediate frustration and uninstalls.&lt;/p&gt;

&lt;h3&gt;
  
  
  Cache Eviction on Mobile Engines
&lt;/h3&gt;

&lt;p&gt;The storage dilemma is aggravated by aggressive eviction heuristics enforced by mobile browser engines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;WebKit (iOS Safari):&lt;/strong&gt; Safari subjects client storage to strict lifetime rules. If a web app is not launched frequently or added to the home screen, Intelligent Tracking Prevention (ITP) and storage pressure algorithms evict IndexedDB and CacheStorage. When the user opens the PWA mid-flight, the model directory is gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chromium (Android):&lt;/strong&gt; When free disk space on a device runs low, Chromium purges non-persisted origins using a least-recently-used (LRU) algorithm. A 500 MB download offers zero durability guarantee.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While &lt;code&gt;navigator.storage.persist()&lt;/code&gt; exists to request durable storage, browsers grant this privilege conservatively based on internal heuristics and site engagement scores.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Model Bottleneck: Why 400 Megabytes Is the Multilingual Floor
&lt;/h2&gt;

&lt;p&gt;Why not simply deploy an ultra-compact 50 MB language model? The answer lies in the fundamental relationship between parameter scale, token density, and reasoning depth. For generative chat in the browser, developers are effectively restricted to three model families:&lt;/p&gt;

&lt;h3&gt;
  
  
  The Three In-Browser Model Families
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model &amp;amp; Build&lt;/th&gt;
&lt;th&gt;Download Size (Quantized)&lt;/th&gt;
&lt;th&gt;VRAM / RAM Footprint&lt;/th&gt;
&lt;th&gt;Multilingual Quality&lt;/th&gt;
&lt;th&gt;Viability for Mobile PWAs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;SmolLM2-360M&lt;/strong&gt; (&lt;code&gt;q4f16_1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;204 MB&lt;/td&gt;
&lt;td&gt;376 MB&lt;/td&gt;
&lt;td&gt;Poor (English-only bias, rapid syntactic collapse)&lt;/td&gt;
&lt;td&gt;Toy demo only; unusable in production&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Qwen2.5-0.5B&lt;/strong&gt; (&lt;code&gt;q4f16_1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;483 MB&lt;/td&gt;
&lt;td&gt;711 MB – 1.1 GB&lt;/td&gt;
&lt;td&gt;Critical (rudimentary grammar, heavy context drift)&lt;/td&gt;
&lt;td&gt;Bare minimum compromise, but 480 MB download&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Llama-3.2-1B&lt;/strong&gt; (&lt;code&gt;q4f16_1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;695 MB&lt;/td&gt;
&lt;td&gt;879 MB – 1.4 GB&lt;/td&gt;
&lt;td&gt;Usable (coherent dialogues, reliable syntax)&lt;/td&gt;
&lt;td&gt;Exceeds mobile cellular data budgets&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Phi-4-mini / Qwen-2B&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;1.1 – 2.3 GB&lt;/td&gt;
&lt;td&gt;2.2 – 4.5 GB&lt;/td&gt;
&lt;td&gt;Good (robust reasoning, structured output)&lt;/td&gt;
&lt;td&gt;Completely unviable for mainstream web distribution&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Quality Cliff Below One Billion Parameters
&lt;/h3&gt;

&lt;p&gt;Models under 500 million parameters (such as SmolLM2-135M or 360M) simply lack the dimensionality to represent nuanced world models, multilingual grammar, and strict instruction adherence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Language Distortion:&lt;/strong&gt; The vast majority of sub-billion pre-training corpora is English. On non-English prompts, token density drops, resulting in hallucinated tokens, mid-sentence language switching, or broken agreement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;System Prompt Collapse:&lt;/strong&gt; When passing a RAG context (Retrieval-Augmented Generation: Supplying extracted document chunks directly inside the prompt so the model bases its answer on verified facts.), sub-500M models regularly ignore system instructions to quote strictly from source material and invent plausible falsehoods instead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WebGPU Buffer Allocations:&lt;/strong&gt; WebGPU enforces strict limits via &lt;code&gt;maxBufferSize&lt;/code&gt; and &lt;code&gt;maxStorageBufferBindingSize&lt;/code&gt;. On integrated mobile GPUs, allocating intermediate attention tensors frequently fails with &lt;code&gt;requested maxBufferSize exceeds limit&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To give users coherent multilingual output, developers are forced to use the 1-billion-parameter tier – requiring a 700 MB initial payload.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Does the Chrome Prompt API Stand and Why Is a Standard Missing?
&lt;/h2&gt;

&lt;p&gt;Wouldn’t the logical architectural solution be a browser-supplied foundation model accessible via standard JavaScript? This is the vision behind Google's Prompt API (An experimental W3C community group specification (LanguageModel) exposing an in-browser foundation model directly to JavaScript.) and Gemini Nano.&lt;/p&gt;

&lt;p&gt;However, the reality in 2026 demonstrates why web architects cannot build mobile PWA stacks on this API:&lt;/p&gt;

&lt;h3&gt;
  
  
  Google's 22-Gigabyte Hardware Gate
&lt;/h3&gt;

&lt;p&gt;The Prompt API (&lt;code&gt;window.LanguageModel&lt;/code&gt;) shipped in Chrome 148 for desktop operating systems. But its hardware gates exclude the mobile PWA market completely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero Support on Android and iOS:&lt;/strong&gt; Neither Chrome on Android nor Chrome on iOS supports the built-in foundation-model APIs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The 22 GB Storage Gate:&lt;/strong&gt; Chrome downloads Gemini Nano only if the volume containing the user profile has at least 22 GB of free space. If free space drops below 10 GB later, the model is automatically evicted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hardware Prerequisites:&lt;/strong&gt; Strictly more than 4 GB of VRAM for the GPU pipeline, or at least 16 GB of RAM and 4 CPU cores for CPU inference.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Worker Execution:&lt;/strong&gt; The APIs are not exposed inside Dedicated Web Workers or Service Workers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Apple and Mozilla Oppose the Specification
&lt;/h3&gt;

&lt;p&gt;The Prompt API is not a W3C Recommendation track standard; it is a Draft Community Group Report produced by the &lt;strong&gt;Web Machine Learning Community Group&lt;/strong&gt;. Both major competing engine vendors have officially rejected the proposal:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mozilla (Firefox):&lt;/strong&gt; Holds an official stance of &lt;strong&gt;"Negative Standards Position"&lt;/strong&gt;. The reasoning: shipping browser-specific models destroys web interoperability. Prompts tuned for Gemini Nano produce erratic, divergent behavior when executed against a different model like Phi-4-mini in another browser.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Apple (WebKit/Safari):&lt;/strong&gt; Holds an official stance of &lt;strong&gt;"Oppose Position"&lt;/strong&gt;, citing critical privacy concerns, lack of portability, and vendor lock-in that would force websites into browser-sniffing branches.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without consensus between Google, Apple, and Mozilla, there is no shared platform layer for web AI. Any site attempting on-device chat today must bundle and ship hundreds of megabytes of raw weights itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Field Test in Looki Looki Me: Benchmarks and Code
&lt;/h2&gt;

&lt;p&gt;During the Progressive Web App migration of lukiluki.me, we ran an empirical test: What happens when an app built for speed and lean resource consumption integrates a real in-browser chat model?&lt;/p&gt;

&lt;h3&gt;
  
  
  Empirical Metrics: Application Code vs. Model Weights
&lt;/h3&gt;

&lt;p&gt;The production build figures highlight the architectural imbalance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complete lukiluki.me offline manifest:&lt;/strong&gt; 74.6 MB (49 pre-rendered routes, 232 static assets, typography, and the full compiled ONNX WebAssembly SIMD runtime).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adding the smallest multilingual chat model (&lt;code&gt;Qwen3-0.6B-q4f16_1&lt;/code&gt;):&lt;/strong&gt; +483 MB additional download.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ratio:&lt;/strong&gt; The AI model accounts for &lt;strong&gt;86.6%&lt;/strong&gt; of the entire PWA’s installed footprint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cold start to first token:&lt;/strong&gt; On a flagship smartphone, decompressing tensor weights and compiling WebGPU pipelines requires &lt;strong&gt;9 to 16 seconds&lt;/strong&gt;. During pipeline compilation, UI frame rates in adjacent tabs drop noticeably.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Resilient Download and Quota Pre-Flight in TypeScript
&lt;/h3&gt;

&lt;p&gt;If your project requires on-device models for specialized enterprise offline workflows, you must never precache weights during the Service Worker install phase. Instead, execute an explicit pre-flight quota check and stream weights in cancelable chunks:&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="cm"&gt;/**
 * Production-ready quota verification and chunked weight streaming.
 * Prevents out-of-quota aborts and supports clean cancellation via AbortSignal.
 */&lt;/span&gt;
&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ModelDownloadOptions&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;modelUrl&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;expectedBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;AbortSignal&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;onProgress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ratio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&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="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;prepareLocalModelStorage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;modelUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;expectedBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;onProgress&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="nc"&gt;ModelDownloadOptions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ArrayBuffer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Pre-flight storage quota before saturating the network&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;estimate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;quota&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;usage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;storage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;estimate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;availableBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;quota&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&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;usage&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="c1"&gt;// Maintain a 200 MB safety buffer for background browser operation&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;availableBytes&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;expectedBytes&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1024&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DOMException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="sb"&gt;`Insufficient storage: ${Math.round(availableBytes / (1024 * 1024))} MB free, `&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;
        &lt;span class="sb"&gt;`required: ${Math.round(expectedBytes / (1024 * 1024))} MB.`&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s2"&gt;"QuotaExceededError"&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="c1"&gt;// 2. Fetch with explicit stream reading and cancellation support&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;modelUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Accept&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"application/octet-stream"&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;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`Model weight transfer failed with status ${response.status}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;contentLength&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Content-Length"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;expectedBytes&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getReader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;receivedBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;done&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;receivedBytes&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;onProgress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;receivedBytes&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;contentLength&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="c1"&gt;// 3. Assemble binary tensor buffer in memory&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;result&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;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;receivedBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;offset&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;offset&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&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="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;buffer&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;
  
  
  How Does Your Current Browser Behave?
&lt;/h2&gt;

&lt;p&gt;Use the following auditor to inspect your device's actual WebGPU adapter, query available storage quota, and calculate the compounding storage duplication across multiple installed PWAs.&lt;/p&gt;

&lt;p&gt;The auditor illustrates the core dilemma: even if your current browser supports WebGPU and allocates generous quota, storage consumption scales linearly with every additional web app. There is zero cross-origin deduplication.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Pragmatic Architecture: What Actually Works Offline
&lt;/h2&gt;

&lt;p&gt;Does this invalidate the concept of offline AI for the web? Not at all. It simply proves that &lt;strong&gt;generative chat models&lt;/strong&gt; are the wrong architectural fit for mobile PWAs today.&lt;/p&gt;

&lt;p&gt;The production architecture powering lukiluki.me separates semantic filtering from generative text synthesis:&lt;/p&gt;

&lt;p&gt;#### Empfohlen (Do): Client-Side Embeddings &amp;amp; Hybrid RAG&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ultra-lightweight vector models:&lt;/strong&gt; Models like &lt;code&gt;Xenova/multilingual-e5-small&lt;/code&gt; require only &lt;strong&gt;25 to 35 MB&lt;/strong&gt; and run smoothly via WebAssembly SIMD on almost any mobile CPU.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pre-computed build vectors:&lt;/strong&gt; Public articles are vectorized at build time. The PWA caches only a compact vector index (under 2 MB for hundreds of articles).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline semantic discovery:&lt;/strong&gt; Users can search offline in flight mode ("slow page load" instantly matches web performance articles).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid cloud generation:&lt;/strong&gt; Only when the user explicitly requests an authored synthesis and an internet connection is active does the app query a fast server-side LLM.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;#### Vermeiden (Don't): Full In-Browser Chat LLMs in PWAs&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Forcing 500 MB downloads on visitors:&lt;/strong&gt; Displaying a multi-minute loading spinner before a user can submit their first prompt.

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Ignoring Same-Origin duplication:&lt;/strong&gt; Expecting users to tolerate multiple PWAs quietly consuming gigabytes of flash storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shipping sub-500M hallucination engines:&lt;/strong&gt; Deploying 360M models that hallucinate and fail basic reasoning tests.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draining mobile batteries:&lt;/strong&gt; Forcing heavy WebGPU matrix multiplication on mobile chipsets, causing immediate thermal throttling.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To understand how lightweight vector math operates without multi-hundred-megabyte baggage, explore our deep dive into &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;Embeddings – Finding Similar Content&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture Checklist for PWA Engineers
&lt;/h2&gt;

&lt;p&gt;Before deciding to integrate an in-browser language model into your web application or PWA, verify these five criteria:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Storage budget audited:&lt;/strong&gt; Does the model payload combined with application assets remain strictly within a defensible cache budget of under 50 MB for mobile users?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Target languages verified:&lt;/strong&gt; Has the model been evaluated against real-world non-English prompts to ensure it does not switch languages or suffer syntactic breakdown?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Eviction resiliency confirmed:&lt;/strong&gt; Does the core application continue to function gracefully when Safari or Android evicts the model cache after several days of inactivity?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Vector embeddings evaluated:&lt;/strong&gt; Can the functional requirement (e.g. search, document triage, classification) be solved using a 25 MB embedding pipeline instead of a 500 MB generative model?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Data transparency provided:&lt;/strong&gt; Is the exact download size, memory requirement, and battery impact disclosed to the user before initiating any transfer?&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and Next Steps
&lt;/h2&gt;

&lt;p&gt;The following primary sources document technical storage boundaries and the active browser standardization debates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://webmachinelearning.github.io/prompt-api/" rel="noopener noreferrer"&gt;W3C Prompt API Explainer&lt;/a&gt; – Community Group specification draft for the &lt;code&gt;LanguageModel&lt;/code&gt; interface.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.chrome.com/docs/ai/get-started" rel="noopener noreferrer"&gt;Chrome for Developers: Built-in AI Requirements&lt;/a&gt; – Official Google documentation covering the 22 GB storage gate and desktop constraints for Gemini Nano.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/mozilla/standards-positions/issues/1213" rel="noopener noreferrer"&gt;Mozilla Standards Positions: Issue #1213&lt;/a&gt; – Mozilla’s formal rejection of the Prompt API due to web interoperability concerns.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/WebKit/standards-positions/issues/495" rel="noopener noreferrer"&gt;WebKit Standards Positions: Issue #495&lt;/a&gt; – Apple’s opposing position regarding Prompt API inclusion in Safari.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2412.15803" rel="noopener noreferrer"&gt;WebLLM Paper (ArXiv:2412.15803)&lt;/a&gt; – Technical evaluation of WebGPU storage buffer allocations and in-browser inference limits.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria" rel="noopener noreferrer"&gt;MDN Web Docs: Storage Quotas and Eviction Criteria&lt;/a&gt; – Comprehensive rules governing browser cache lifetimes and quota policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Review the architectural runtime foundation in &lt;a href="https://lukiluki.me/en/garden/offline-ai" rel="noopener noreferrer"&gt;Offline AI in Web Apps&lt;/a&gt;, explore &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;Embeddings – Finding Similar Content&lt;/a&gt; for resource-friendly vector search, and read &lt;a href="https://lukiluki.me/garden/webnn" rel="noopener noreferrer"&gt;WebNN – Machine Learning in the Browser&lt;/a&gt; for upcoming hardware-accelerated NPU standards.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/browser-llms" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webllm</category>
      <category>pwa</category>
      <category>webgpu</category>
      <category>transformersjs</category>
    </item>
    <item>
      <title>Ambient Mode – From Color Scheme to a Living Interface</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:43:26 +0000</pubDate>
      <link>https://dev.to/lnk1812/ambient-mode-from-color-scheme-to-a-living-interface-nh6</link>
      <guid>https://dev.to/lnk1812/ambient-mode-from-color-scheme-to-a-living-interface-nh6</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/ambient-mode" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You open the same website at midday and late in the evening. The text stays familiar, but the light changes, the sky grows calmer and summer greens become winter outlines. Can an interface feel alive without making you learn new controls on every visit?&lt;/p&gt;

&lt;p&gt;Ambient Mode adds atmosphere to light and dark reading colors: light, gradients, time of day or seasons change the background while content and controls stay dependable. This can give a website character and express personal preferences. Separate design layers, respect for system preferences and deliberate user control are essential. An attractive effect alone proves neither improved usability nor lower energy consumption.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Design principle):&lt;/strong&gt;&lt;br&gt;
Reading colors provide orientation, atmosphere sets the mood, and users decide how much change they want.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What changes between color scheme and atmosphere?
&lt;/h2&gt;

&lt;p&gt;Dark and light modes first define which surfaces and text colors are readable together. Atmosphere can go further by borrowing light from content, representing a time of day or adding seasonal accents. Here, “Ambient Mode” is a design term, rather than the name of a single web standard.&lt;/p&gt;

&lt;p&gt;A concrete product example is &lt;a href="https://support.google.com/youtube/answer/12827017?hl=en&amp;amp;co=GENIE.Platform%3DDesktop" rel="noopener noreferrer"&gt;YouTube's Ambient Mode&lt;/a&gt;: video colors gently spread into the surrounding background. The effect complements the dark color scheme. A broader pattern follows: content or context supplies the mood, while the interface retains its purpose.&lt;/p&gt;

&lt;p&gt;Three layers are useful for a digital garden:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reading:&lt;/strong&gt; Text, reading surfaces, links and focus indicators need tested light and dark variants.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atmosphere:&lt;/strong&gt; Sky, glow and landscape change; they convey no essential information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meaning:&lt;/strong&gt; Categories keep their colors, whether it is autumn or nighttime.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Colors and spacing are stored as design tokens (Named design values, such as text color, background, spacing or category accent, shared by components.). A warm evening sky can sit behind a clearly recognizable pink design tile. The season determines the surroundings; the category explains the content.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who decides: the system, the clock or the person?
&lt;/h2&gt;

&lt;p&gt;The system preference is a good starting point because people may already have chosen reading colors in their operating system or browser. The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme" rel="noopener noreferrer"&gt;CSS query &lt;code&gt;prefers-color-scheme&lt;/code&gt;&lt;/a&gt; exposes that preference. It says nothing about actual room lighting or the local position of the sun.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;What controls the interface?&lt;/th&gt;
&lt;th&gt;Suitable for&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;System&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The light or dark browser/OS scheme; the season follows the calendar.&lt;/td&gt;
&lt;td&gt;A respectful default without an additional decision.&lt;/td&gt;
&lt;td&gt;The system does not provide a time-of-day atmosphere.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Local time and calendar determine reading colors and atmosphere.&lt;/td&gt;
&lt;td&gt;A page whose mood follows the day.&lt;/td&gt;
&lt;td&gt;Fixed times are not measured sunrise and sunset times.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Manual&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A chosen time and season determine the appearance.&lt;/td&gt;
&lt;td&gt;A personal mood independent of the actual date.&lt;/td&gt;
&lt;td&gt;This is a deliberate departure from the system preference.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here in the garden, the page starts with &lt;strong&gt;System&lt;/strong&gt;. Only &lt;strong&gt;Auto&lt;/strong&gt; or &lt;strong&gt;Manual&lt;/strong&gt; takes over control. Auto uses simple day boundaries of 06:30 and 18:30; the four seasons follow Northern Hemisphere meteorological months. This is a transparent design rule, rather than a location or weather sensor. The automatic season may therefore be unsuitable for visitors in the Southern Hemisphere.&lt;/p&gt;

&lt;p&gt;Try &lt;strong&gt;Manual&lt;/strong&gt; in the header, or &lt;strong&gt;Menu → Ambience&lt;/strong&gt; on a phone: move the time from midday to night and switch from summer to winter. Sky, light and vegetation respond; navigation and categories stay familiar. Returning to &lt;strong&gt;System&lt;/strong&gt; hands reading colors back to the browser and operating system. This experiment demonstrates the design; it does not measure energy savings.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do transitions work with native CSS?
&lt;/h2&gt;

&lt;p&gt;A convincing transition does not need a new background image for every hour. A few color stops and calculated intermediate values are enough for a calm progression through the day. In this garden, sky colors are mixed between such stops; sun, moon and seasonal shapes complete the scene. The reading scheme still switches between light and dark variants, rather than making every intermediate color a new text palette. Both variants and their actual backgrounds belong in the contrast check.&lt;/p&gt;

&lt;p&gt;Native CSS provides useful building blocks for new interfaces: &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark" rel="noopener noreferrer"&gt;&lt;code&gt;light-dark()&lt;/code&gt;&lt;/a&gt; chooses between two color values according to the active &lt;code&gt;color-scheme&lt;/code&gt;; &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@property" rel="noopener noreferrer"&gt;&lt;code&gt;@property&lt;/code&gt;&lt;/a&gt; gives a custom CSS variable a type and enables interpolated animation. MDN lists the color variant of &lt;code&gt;light-dark()&lt;/code&gt; as Baseline since May 2024, and &lt;code&gt;@property&lt;/code&gt; since July 2024. That is useful compatibility guidance, rather than a guarantee for old browsers or embedded WebViews.&lt;/p&gt;

&lt;p&gt;The following CSS is a small standalone recipe for an existing &lt;code&gt;.reading-surface&lt;/code&gt; text area and a decorative &lt;code&gt;.ambient-layer&lt;/code&gt; background. Both elements must exist, and the application must set &lt;code&gt;data-time="evening"&lt;/code&gt; on the root element after an explicit time selection. Without that attribute, the initial state remains. The colors are examples, rather than a fully tested product palette.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@property&lt;/span&gt; &lt;span class="nv"&gt;--ambient-light&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;syntax&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;color&amp;gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;inherits&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;initial-value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;249&lt;/span&gt; &lt;span class="mi"&gt;196&lt;/span&gt; &lt;span class="mi"&gt;131&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="kt"&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;span class="nt"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;light&lt;/span&gt; &lt;span class="n"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.reading-surface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#172033&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#faf8f4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.reading-surface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#e8edf5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#171c29&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;@supports&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;light-dark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;white&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nt"&gt;black&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="nc"&gt;.reading-surface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;light-dark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;#172033&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;#e8edf5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;light-dark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mh"&gt;#faf8f4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;#171c29&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="nc"&gt;.ambient-layer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;pointer-events&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;radial-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;ellipse&lt;/span&gt; &lt;span class="n"&gt;at&lt;/span&gt; &lt;span class="mi"&gt;75&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--ambient-light&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;transparent&lt;/span&gt; &lt;span class="mi"&gt;65&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;--ambient-light&lt;/span&gt; &lt;span class="mi"&gt;700ms&lt;/span&gt; &lt;span class="n"&gt;ease&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="nt"&gt;root&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-time&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"evening"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="nc"&gt;.ambient-layer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--ambient-light&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;rgb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;147&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt; &lt;span class="mi"&gt;221&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt;&lt;span class="kt"&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="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-reduced-motion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nc"&gt;.ambient-layer&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;none&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;The reading surface stays opaque and follows the system; the glow has its own responsibility. Without &lt;code&gt;light-dark()&lt;/code&gt;, the preceding colors and media query apply. Without &lt;code&gt;@property&lt;/code&gt;, changing the custom variable may be abrupt, but the content remains readable. Gentle transforms and opacity changes are another option for continuous sun paths. Add a large blur or continuously running canvas scene only after checking performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What does OLED actually have to do with energy?
&lt;/h2&gt;

&lt;p&gt;On OLED (Organic Light-Emitting Diode: Pixels emit their own light instead of being lit by a shared backlight.) displays, darker pixels need less energy. That explains a potential advantage of dark surfaces. This pixel-level saving does not directly carry over to a conventional backlit LCD (Liquid Crystal Display: A screen whose liquid crystal pixels are illuminated by a backlight.). Dark Mode also has design and personal motivations and cannot be reduced to a single historical purpose.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://www.purdue.edu/newsroom/archive/releases/2021/Q3/dark-mode-may-not-save-your-phones-battery-life-as-much-as-you-think,-but-there-are-a-few-silver-linings.html" rel="noopener noreferrer"&gt;2021 Purdue study&lt;/a&gt; examined six Android apps on four OLED smartphones, each during 60 seconds of use. At 30–50 percent brightness, Dark Mode saved an average of 3–9 percent of total phone power; at 100 percent brightness, savings were 39–47 percent. These results describe the devices and workflows studied, rather than savings for every website or current hardware.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A glow is not evidence of energy savings&lt;/strong&gt;&lt;br&gt;
Bright backgrounds and additional animation can increase display and&lt;br&gt;
  computation costs. Ambient Mode can use less or more energy; without&lt;br&gt;
  measurement on the target device, the balance remains unknown.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Battery life between charges&lt;/strong&gt;, &lt;strong&gt;battery lifespan&lt;/strong&gt; and &lt;strong&gt;display aging&lt;/strong&gt; are also different questions. Longer runtime between charges does not establish a longer device lifespan. &lt;a href="https://support.apple.com/en-us/109039" rel="noopener noreferrer"&gt;Apple describes OLED burn-in&lt;/a&gt; as a possible result of high-contrast static images displayed for long periods at high brightness, and recommends automatic brightness and a short screen lock interval among other measures. An animated website offers no guaranteed protection; bright icons that remain in place in Dark Mode are still static image elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  When does atmosphere help, and when does it distract?
&lt;/h2&gt;

&lt;p&gt;A garden, portfolio or media site can gain a recognizable character from subtle changes in light. An administrative interface, long work form or focused reading view may be better served by a quiet background. This is a design hypothesis: whether atmosphere improves recognition, time spent or enjoyment must be tested with real users.&lt;/p&gt;

&lt;p&gt;Readability matters between the attractive end states too. Version 2.2 of the WCAG (Web Content Accessibility Guidelines: The W3C's guidelines for accessible web content.) requires &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" rel="noopener noreferrer"&gt;at least 4.5:1 contrast&lt;/a&gt; for normal text and 3:1 for qualifying large text. Behind translucent surfaces, a moving glow can alter the actual visible background. Check intermediate states or use an opaque reading surface.&lt;/p&gt;

&lt;p&gt;Motion is a separate decision. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion" rel="noopener noreferrer"&gt;&lt;code&gt;prefers-reduced-motion&lt;/code&gt;&lt;/a&gt; signals a preference for less nonessential animation. Sun and moon can remain still while selected colors and seasons continue to work. For a complete product, a separate control to disable decorative effects is also useful; a system preference alone does not cover every wish.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four checks before using it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Respect the system:&lt;/strong&gt; Without a saved, deliberate override, the page starts in the browser/OS scheme and follows changes to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Read intermediate states:&lt;/strong&gt; Check midday, twilight, night and every season; text and focus indicators remain visible against their actual backgrounds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep controls calm:&lt;/strong&gt; Enable reduced motion and use sliders, mode selection and seasons by keyboard; decoration must not intercept clicks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Measure the cost:&lt;/strong&gt; On a less powerful target device, check CPU and GPU activity and smooth scrolling; energy claims also need appropriate hardware measurements.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;p&gt;Source research and verification in the original article: October 7, 2026. The Purdue figures explicitly come from 2021; the garden rules are an original implementation example.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://support.google.com/youtube/answer/12827017?hl=en&amp;amp;co=GENIE.Platform%3DDesktop" rel="noopener noreferrer"&gt;YouTube: Ambient Mode&lt;/a&gt; – a concrete use in a media product.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme" rel="noopener noreferrer"&gt;MDN: &lt;code&gt;prefers-color-scheme&lt;/code&gt;&lt;/a&gt;, &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/color_value/light-dark" rel="noopener noreferrer"&gt;&lt;code&gt;light-dark()&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@property" rel="noopener noreferrer"&gt;&lt;code&gt;@property&lt;/code&gt;&lt;/a&gt; – system preferences and native color features.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.purdue.edu/newsroom/archive/releases/2021/Q3/dark-mode-may-not-save-your-phones-battery-life-as-much-as-you-think,-but-there-are-a-few-silver-linings.html" rel="noopener noreferrer"&gt;Purdue: Dark Mode measurements&lt;/a&gt; and &lt;a href="https://dl.acm.org/doi/10.1145/3458864.3467682" rel="noopener noreferrer"&gt;original paper by Dash and Hu, MobiSys 2021&lt;/a&gt; – method and limitations of OLED energy claims.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://support.apple.com/en-us/109039" rel="noopener noreferrer"&gt;Apple: OLED displays&lt;/a&gt; – image persistence, burn-in and brightness.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html" rel="noopener noreferrer"&gt;W3C: Minimum contrast&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-reduced-motion" rel="noopener noreferrer"&gt;MDN: Reduced motion&lt;/a&gt; – boundaries for comfortable design.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;a href="https://lukiluki.me/garden/accessibility" rel="noopener noreferrer"&gt;Accessibility tile&lt;/a&gt; explores contrast and usability further. &lt;a href="https://lukiluki.me/en/garden/explainable-text" rel="noopener noreferrer"&gt;Explainable Text&lt;/a&gt; shows another kind of adaptation: readers choose the depth of information there, and the atmosphere here.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/ambient-mode" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>mediaqueries</category>
      <category>designtokens</category>
      <category>oled</category>
    </item>
    <item>
      <title>Obsidian and Graphify – Using and Measuring Project Knowledge for Coding Agents</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:43:16 +0000</pubDate>
      <link>https://dev.to/lnk1812/obsidian-and-graphify-using-and-measuring-project-knowledge-for-coding-agents-58if</link>
      <guid>https://dev.to/lnk1812/obsidian-and-graphify-using-and-measuring-project-knowledge-for-coding-agents-58if</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/brownfield-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A new agent session starts, and the agent is already searching for a solution that exists in the project. Why is this fallback still here? Which modules depend on the checkout? Two tools can help recover this project knowledge: Graphify for code relationships and Obsidian for recorded decisions.&lt;/p&gt;

&lt;p&gt;Graphify makes relationships between project files accessible as a queryable graph; Obsidian stores decisions and solved problems in local Markdown notes. A coding agent can read this context selectively and then check it against the source code. Early Graphify benchmarks exist, but the sources reviewed here do not establish a general productivity gain from combining the tools. Compare correctly solved tasks, costs and rework to assess their value in your project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Project knowledge only helps when the agent finds relevant information and uses it correctly. Measure verified solutions and the effort required to reach acceptance.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do Graphify and Obsidian complement each other?
&lt;/h2&gt;

&lt;p&gt;In an established codebase, knowledge lives in different places. Source code shows implemented relationships. Decision notes can explain why a seemingly unnecessary retry remains necessary for an old payment provider. Both can matter when making a change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Graphify provides a map of the project.&lt;/strong&gt; The tool extracts code structures locally with Tree-sitter, a syntax tree parser. This produces nodes and relationships for functions, imports and calls, for example. Documents and images can additionally undergo semantic extraction by a language model. That extension needs a suitable backend and can consume tokens. Local code analysis and document processing therefore have different costs and data flows. The &lt;a href="https://github.com/Graphify-Labs/graphify/blob/v8/docs/how-it-works.md" rel="noopener noreferrer"&gt;Graphify pipeline&lt;/a&gt; documents this separation.&lt;/p&gt;

&lt;p&gt;A graph suggests which modules may be affected. It proves neither that all runtime relationships are covered nor that a change is safe. Dynamically resolved calls and stale indexes must be checked against current code and tests. A high number of connections alone is not a measured indicator of defects either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Obsidian records the reasoning.&lt;/strong&gt; A vault (A local folder containing Markdown notes and the associated Obsidian settings.) contains ordinary files. An agent with appropriate file access can read them without necessarily needing an additional integration. The &lt;a href="https://help.obsidian.md/Files+and+folders/How+Obsidian+stores+data" rel="noopener noreferrer"&gt;Obsidian storage documentation&lt;/a&gt; confirms this. A short note should name the problem, decision, affected files and evidence that the solution works. A date and verified commit help readers judge its freshness.&lt;/p&gt;

&lt;p&gt;A compatible agent can also query Graphify through MCP (Model Context Protocol: An interface through which an agent can use available tools and data sources.). An additional Obsidian server can expose notes; its specific tools depend on the implementation. The interface makes context available. For that context to reach the next session, the agent must actually retrieve it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: An old checkout fallback
&lt;/h3&gt;

&lt;p&gt;Before making a change, the agent searches for the affected function and its callers. Graphify can reveal relationships with further modules. The agent then reads a relevant decision note in Obsidian: the fallback handles delayed responses from a payment provider. Only then does it check the implementation and corresponding regression test. After the work, it records new findings with file references. This example describes a possible workflow, not a measured improvement.&lt;/p&gt;

&lt;h2&gt;
  
  
  What measurements already exist for Graphify?
&lt;/h2&gt;

&lt;p&gt;Graphify publishes its own benchmark with a documented test procedure. The figures below come from its &lt;a href="https://github.com/Graphify-Labs/graphify/blob/v8/BENCHMARKS.md" rel="noopener noreferrer"&gt;BENCHMARKS.md&lt;/a&gt;, retrieved on October 19, 2026. They are the project's own results; the report does not establish independent replication or a test of Graphify combined with an Obsidian vault.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Test in the Graphify report&lt;/th&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Code questions about ERPNext, 6 questions&lt;/td&gt;
&lt;td&gt;Coverage of predefined key facts&lt;/td&gt;
&lt;td&gt;Graphify 82.0%, file search and reading 70.8%&lt;/td&gt;
&lt;td&gt;Evaluates answers about code, rather than implemented bug fixes or working time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOCOMO, 300 questions from conversations across multiple sessions&lt;/td&gt;
&lt;td&gt;Answer accuracy&lt;/td&gt;
&lt;td&gt;Graphify 45.3%, BM25 31.3%&lt;/td&gt;
&lt;td&gt;Measures conversational memory, rather than repository changes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LOCOMO, the same selection&lt;/td&gt;
&lt;td&gt;Retrieval recall@10&lt;/td&gt;
&lt;td&gt;Graphify 0.497, BM25 0.362&lt;/td&gt;
&lt;td&gt;Measures finding relevant information among ten results, rather than code quality&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LongMemEval-S, 50 questions&lt;/td&gt;
&lt;td&gt;Answer accuracy&lt;/td&gt;
&lt;td&gt;Graphify 76%, Dense RAG 76%&lt;/td&gt;
&lt;td&gt;Small selection; the same score as vector search in this test&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Retrieval recall@10 (The share of relevant information sought that appears in the first ten returned results, according to the particular benchmark's definition.) describes retrieval before the answer. An agent can find correct information and still write an incorrect change. Conversely, it can solve some tasks without additional retrieval. BM25 (A method that scores documents based on query terms and their frequency.) is a text-based baseline here. Dense RAG (Retrieval-Augmented Generation using vector search: A language model receives additional passages whose vectors match the query.) provides another comparison.&lt;/p&gt;

&lt;p&gt;The code experiment reports &lt;strong&gt;11.2 percentage points more fact coverage&lt;/strong&gt;. According to the report, it uses a fixed agent with Claude Opus 4.8 and at most 14 rounds. The six questions and automatic scoring procedure limit generalization. The memory tests use Kimi K2.6 for answering and evaluation. Each set of comparison figures belongs to its particular setup and should not be mixed with results from other procedures.&lt;/p&gt;

&lt;p&gt;Token figures also need a reference point. For a mixed corpus of 52 files, the &lt;a href="https://github.com/Graphify-Labs/graphify/blob/v8/docs/how-it-works.md" rel="noopener noreferrer"&gt;pipeline documentation&lt;/a&gt; reports &lt;strong&gt;71.5 times fewer tokens per query than directly reading the raw files&lt;/strong&gt;. This is a project-specific comparison. Graph construction and maintenance, repeated attempts and the quality of the finished solution must be accounted for separately. It does not imply a universal saving for coding tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do other studies say about coding agents?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;SWE-bench Verified measures solved software tasks.&lt;/strong&gt; The &lt;a href="https://www.swebench.com/verified.html" rel="noopener noreferrer"&gt;benchmark&lt;/a&gt; contains 500 human-verified tasks from real repositories. For coding agents, the share of tasks solved is closer to the outcome of a change than answer accuracy alone. The model, agent logic, tools and budget jointly influence the result. The benchmark studies neither Obsidian nor Graphify in isolation and does not replace evaluation in your own project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Additional context can create overhead.&lt;/strong&gt; The paper &lt;a href="https://arxiv.org/abs/2602.11988v3" rel="noopener noreferrer"&gt;Evaluating AGENTS.md&lt;/a&gt;, cited here in version 3 dated September 29, 2026, reports no general improvement in success rates from context files across different agents and models, with average inference costs increasing by more than 20 percent. It studies repository context files, rather than targeted Obsidian retrieval. The practical implication is a hypothesis to test: short, task-specific notes might be more useful than project overviews supplied on every run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Perceived time savings can be misleading.&lt;/strong&gt; In a &lt;a href="https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study/" rel="noopener noreferrer"&gt;randomized METR study from 2025&lt;/a&gt;, 16 experienced developers took an average of 19 percent longer on 246 tasks with the AI tools available at the time. The study concerns that working context, primarily Cursor with Claude 3.5/3.7 Sonnet. It does not establish a corresponding slowdown for today's agents. The &lt;a href="https://metr.org/blog/2026-02-24-uplift-update/" rel="noopener noreferrer"&gt;METR update from February 2026&lt;/a&gt; describes signs of acceleration, but considers its magnitude unreliable because of selection bias and difficulties measuring time.&lt;/p&gt;

&lt;p&gt;These studies answer different questions: finding information, solving a task correctly and saving people time at work. Measure these layers separately when evaluating a knowledge base.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you measure value in your own repository?
&lt;/h2&gt;

&lt;p&gt;For an initial comparison, you need bounded tasks with known acceptance criteria, a fixed repository state and a recorded model with a consistent budget. Define beforehand which tests and expert checks a solution must pass. Use only knowledge available before the respective task: a solution note written afterward would contaminate the result.&lt;/p&gt;

&lt;p&gt;Compare four conditions: &lt;strong&gt;file search alone&lt;/strong&gt;, &lt;strong&gt;file search with Obsidian&lt;/strong&gt;, &lt;strong&gt;file search with Graphify&lt;/strong&gt; and &lt;strong&gt;file search with both tools&lt;/strong&gt;. Source code and tests remain accessible under every condition. This lets you examine the tools' additional contribution and whether combining them helps.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;What you record&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;Success rate&lt;/td&gt;
&lt;td&gt;Accepted solutions divided by all started tasks&lt;/td&gt;
&lt;td&gt;Includes failures and timeouts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Human effort&lt;/td&gt;
&lt;td&gt;Minutes spent on setup, supervision, review and rework&lt;/td&gt;
&lt;td&gt;Shows whether work is removed or shifted elsewhere&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lead time&lt;/td&gt;
&lt;td&gt;Time from start to acceptance, with a fixed timeout&lt;/td&gt;
&lt;td&gt;Makes additional queries and retries visible&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost per accepted solution&lt;/td&gt;
&lt;td&gt;Total API costs of all attempts and indexing runs divided by accepted solutions&lt;/td&gt;
&lt;td&gt;Prevents failed attempts from disappearing from the accounting&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reused knowledge&lt;/td&gt;
&lt;td&gt;Earlier decisions applied correctly with checked evidence&lt;/td&gt;
&lt;td&gt;Tests the expected benefit of notes directly&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Start each agent run with a fresh history and a clean checkout. Use the same tasks under each condition, vary their order and repeat runs because agents can respond differently. Where possible, evaluate solutions without knowing the condition. For repeated sessions, also freeze an identical collection of earlier notes. A separate study of growing note collections must prevent knowledge transfer between conditions.&lt;/p&gt;

&lt;p&gt;Also record input, output and cache tokens, tool calls, versions and the state of the graph and notes. Keep human working time separate from agent runtime. If no solutions are accepted, cost per solution remains undefined; report total incurred costs and failures instead. Publish task count, variation and uncertainty alongside averages. A small pilot provides indications for this project.&lt;/p&gt;

&lt;h2&gt;
  
  
  When is this workflow worthwhile?
&lt;/h2&gt;

&lt;p&gt;Graphify is a candidate when a task requires understanding relationships across files. Obsidian is a candidate when earlier decisions or known exceptions matter for the next session. A small, well-documented change may be faster with direct search. Ongoing maintenance of both knowledge sources belongs in the assessment of their value.&lt;/p&gt;

&lt;p&gt;The routine described in the presentation can first be tried on a small scale: consult relevant notes before working, then record confirmed findings at the end. Skills or hooks can support this routine. Available triggers and access depend on the agent. Review an automatically generated session log before treating it as a reliable statement about the project.&lt;/p&gt;

&lt;p&gt;Before your first comparison, check that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Acceptance criteria are defined before the first run and apply to all conditions.&lt;/li&gt;
&lt;li&gt;The graph and notes reference traceable sources and a known project state.&lt;/li&gt;
&lt;li&gt;A recorded file read or tool call shows whether the agent consulted the knowledge sources.&lt;/li&gt;
&lt;li&gt;Evaluation includes failed attempts, setup, maintenance and human rework.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;p&gt;Research as of October 19, 2026. The Graphify figures are the project's own measurements. The context-file and developer-productivity studies examine other conditions. No original test of the Obsidian and Graphify combination was performed for this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/Graphify-Labs/graphify" rel="noopener noreferrer"&gt;Graphify: Repository and integrations&lt;/a&gt; – capabilities and agent access.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Graphify-Labs/graphify/blob/v8/BENCHMARKS.md" rel="noopener noreferrer"&gt;Graphify: Benchmarks and test setup&lt;/a&gt; – source of the tabulated measurements.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/Graphify-Labs/graphify/blob/v8/docs/how-it-works.md" rel="noopener noreferrer"&gt;Graphify: Extraction pipeline and token comparison&lt;/a&gt; – local analysis and model-assisted processing.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://help.obsidian.md/Files+and+folders/How+Obsidian+stores+data" rel="noopener noreferrer"&gt;Obsidian: Local file storage&lt;/a&gt; – the basis of a vault.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.swebench.com/verified.html" rel="noopener noreferrer"&gt;SWE-bench Verified&lt;/a&gt; – verifiable software tasks as an evaluation model.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2602.11988v3" rel="noopener noreferrer"&gt;Evaluating AGENTS.md, version 3&lt;/a&gt; – effects and costs of additional context files.&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: 2025 study&lt;/a&gt; and &lt;a href="https://metr.org/blog/2026-02-24-uplift-update/" rel="noopener noreferrer"&gt;2026 update&lt;/a&gt; – productivity measurement and its limits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For acceptance of your own agent changes, &lt;a href="https://lukiluki.me/en/garden/testing" rel="noopener noreferrer"&gt;Testing&lt;/a&gt; explains how to use technical checks. &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;Embeddings&lt;/a&gt; explains vector search as an alternative retrieval strategy.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/brownfield-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>obsidian</category>
      <category>graphify</category>
      <category>markdown</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Embeddings – Finding Related Content</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:43:07 +0000</pubDate>
      <link>https://dev.to/lnk1812/embeddings-finding-related-content-27a9</link>
      <guid>https://dev.to/lnk1812/embeddings-finding-related-content-27a9</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You search for “forgot password”, but the relevant help article is called “restore account access”. A search that only matches those words might miss it. How can it still find the right content?&lt;/p&gt;

&lt;p&gt;Embeddings help search find related content across different phrasings. A trained model turns queries and passages into numerical vectors. A mathematical comparison then identifies candidates whose content might match the query. This extends word matching with a measure of semantic proximity. The application still needs to check whether a result is useful, correct and appropriate for the user's context.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Embeddings make semantic proximity computable. They help find relevant candidates, but a numerical score cannot establish relevance or correctness on its own.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How text becomes comparable numbers
&lt;/h2&gt;

&lt;p&gt;An embedding model learns relationships between texts during training. It can therefore connect related phrasings even when they share few words. For each input, it calculates a vector (An ordered list of numbers; each number is a coordinate in the model's representation of the text.). The length of that list is the number of dimensions.&lt;/p&gt;

&lt;p&gt;Imagine a space where related content points in similar directions. “Forgot password” and “restore account access” might be closer together than “change delivery address”. Unlike a map, this space often has hundreds or thousands of dimensions. Individual coordinates generally cannot be read as properties such as “password” or “problem”. The relationship comes from the whole vector.&lt;/p&gt;

&lt;p&gt;Context matters. “I sat on the river bank” and “I transferred money to my bank” use the same word for different things. An embedding represents the particular text, rather than one fixed word meaning for every situation.&lt;/p&gt;

&lt;h2&gt;
  
  
  How this becomes a search system
&lt;/h2&gt;

&lt;p&gt;For documentation search, first divide content into meaningful passages and store their embeddings. At query time, calculate only the new query vector and compare it with the stored vectors:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Prepare content:&lt;/strong&gt; Store the vector for a password-reset passage alongside its text and source link.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Represent the query:&lt;/strong&gt; Embed “forgot password” with the same model and a compatible search configuration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find candidates:&lt;/strong&gt; Rank passages by their comparison scores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Select results:&lt;/strong&gt; Filter by additional criteria such as language, freshness or product version.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Passage size affects retrieval. A whole article may mix several topics; a single sentence may lose essential context. Useful passages address one coherent question and retain enough information to make sense on their own.&lt;/p&gt;

&lt;p&gt;Exact identifiers such as “ERR-1042” still benefit from lexical search. Both methods can be combined: keywords match the exact spelling, while embeddings find related formulations. &lt;a href="https://lukiluki.me/garden/intuitive-search" rel="noopener noreferrer"&gt;Intuitive Search&lt;/a&gt; explains the first building block.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a similarity score tells you
&lt;/h2&gt;

&lt;p&gt;A common comparison is cosine similarity (The dot product of two vectors divided by the product of their lengths.). It compares vector direction independently of length. Its range is −1 to +1, with higher scores indicating more similar directions. A score of 0.8 does not mean “80 percent identical meaning”.&lt;/p&gt;

&lt;p&gt;For search, ranking is the first concern: does the password-reset guide appear before the delivery-address article? There is no universal threshold for a good result. You need representative queries and judgments about which passages should answer them. Compare only vectors from the same model with compatible configurations and the same number of dimensions.&lt;/p&gt;

&lt;p&gt;Topic similarity can also conceal a crucial difference. “I like coffee” and “I do not like coffee” both concern coffee but contradict each other. A high score may identify an interesting candidate without confirming its statement. The same applies to outdated instructions and factually incorrect text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where embeddings help
&lt;/h2&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;Contribution from embeddings&lt;/th&gt;
&lt;th&gt;What else is needed&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Search documentation&lt;/td&gt;
&lt;td&gt;Find related phrasings&lt;/td&gt;
&lt;td&gt;Check relevance and version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recommend similar articles&lt;/td&gt;
&lt;td&gt;Suggest related topics&lt;/td&gt;
&lt;td&gt;Consider quality and reader interests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Group texts by topic&lt;/td&gt;
&lt;td&gt;Bring related content together&lt;/td&gt;
&lt;td&gt;Review and name the groups&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Find an exact product number&lt;/td&gt;
&lt;td&gt;Add thematic context&lt;/td&gt;
&lt;td&gt;Exact identifier matching&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Check contradictions or facts&lt;/td&gt;
&lt;td&gt;Retrieve related statements&lt;/td&gt;
&lt;td&gt;Evaluate statements and evidence&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Retrieval in RAG
&lt;/h3&gt;

&lt;p&gt;In RAG (Retrieval-Augmented Generation: Relevant passages are retrieved and supplied to a language model as context for its answer.), embedding search can retrieve passages from a knowledge collection. A language model then writes an answer using that context. The vectors themselves contain neither readable source text nor a finished answer; the retrieved passages must be loaded too.&lt;/p&gt;

&lt;p&gt;Answer quality therefore also depends on retrieving the right sources. A high similarity score cannot compensate for a missing or unsuitable passage. An agent executing a specific function is a separate capability: &lt;a href="https://lukiluki.me/en/garden/web-mcp" rel="noopener noreferrer"&gt;Web MCP&lt;/a&gt; explains how to expose those tools.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test similarity yourself
&lt;/h2&gt;

&lt;p&gt;Try “forgot password”, “restore account access” and “change delivery address” below. Calculate embeddings and check which pair ranks highest. Then compare the two coffee sentences: does topical proximity remain high despite the contradiction? This experiment compares short texts; it does not evaluate an entire documentation search system.&lt;/p&gt;

&lt;p&gt;The initial saved examples retain their original German and English words and vectors. Translating a word while keeping its old vector would misrepresent the data. The saved file records neither its model nor its generation date, so treat it as an illustrative starting point. New inputs require a fresh calculation using the selected AI backend; the interface distinguishes saved, changed and newly calculated results. No API key is required to inspect saved comparisons; new cloud requests require a configured backend, while local inference requires prepared model files and a suitable device.&lt;/p&gt;

&lt;h3&gt;
  
  
  Further detail: Metrics and dimensions
&lt;/h3&gt;

&lt;p&gt;Cosine compares directions. Euclidean distance measures direct distance, while Manhattan distance sums absolute coordinate differences. For both distances, smaller values indicate greater proximity. Their values cannot be compared directly with cosine scores, and vector length affects them too.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;\cos(\theta) = \frac{A \cdot B}{\|A\|\,\|B\|}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dimensions slider uses only the first coordinates of existing vectors. It does not generate new embeddings. This can change the ranking. Some models are specifically trained to work with shortened vectors. Arbitrary truncation is not a general quality improvement: choose dimensions according to the model and actual retrieval tasks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checklist for embedding search
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Collect representative queries and record which passages should answer them.&lt;/li&gt;
&lt;li&gt;[ ] Split documents into coherent passages and preserve text, source and metadata.&lt;/li&gt;
&lt;li&gt;[ ] Use a compatible model and configuration for documents and queries.&lt;/li&gt;
&lt;li&gt;[ ] Test synonyms, ambiguous terms, contradictions and exact identifiers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Primary sources
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://sbert.net/examples/sentence_transformer/applications/semantic-search/README.html" rel="noopener noreferrer"&gt;Sentence Transformers: Semantic search, queries and documents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://sbert.net/docs/sentence_transformer/usage/semantic_textual_similarity.html" rel="noopener noreferrer"&gt;Sentence Transformers: Text similarity and comparison metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ai.google.dev/gemini-api/docs/embeddings" rel="noopener noreferrer"&gt;Google: Embeddings, retrieval tasks and dimension reduction&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>vectors</category>
      <category>cosinesimilarity</category>
      <category>rag</category>
      <category>gemini</category>
    </item>
    <item>
      <title>Explainable Text – Interactive Inline Explanations in Reading Flow</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:51 +0000</pubDate>
      <link>https://dev.to/lnk1812/explainable-text-interactive-inline-explanations-in-reading-flow-479n</link>
      <guid>https://dev.to/lnk1812/explainable-text-interactive-inline-explanations-in-reading-flow-479n</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/explainable-text" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You are reading a hardware datasheet for 3D printers or an architecture whitepaper on web performance and stumble across technical terms: What exactly does FDM technology (Fused Deposition Modeling: Additive manufacturing method extruding melted thermoplastic filament layer by layer) mean, what sound level hides behind quiet operation (under 42 dB(A) in normal operating mode), and why does frontend architecture require an INP budget under 200 ms (Interaction to Next Paint: Google Core Web Vital measuring seamless response times to touch and click events)? Up until now, there were only bad compromises: Authors bloated sentences with clumsy parentheses, hid details in tooltips that break on mobile touchscreens, or forced tab hops via external links. Reading flow collapses; mental focus is shattered.&lt;/p&gt;

&lt;p&gt;Explainable Text (originally coined as &lt;em&gt;StretchText&lt;/em&gt; by hypertext pioneer Ted Nelson in 1967) is a progressive interaction pattern for digital typography. Jargon, metrics, or abbreviations receive interactive inline triggers: A single click unfolds in-depth explanations seamlessly right within the running sentence – either as smooth insertion or fluid character streaming – without forcing popovers, modals, or disruptive context switches.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (The Golden Rule):&lt;/strong&gt;&lt;br&gt;
Explainable Text respects the reader's focus: Deeper context unfolds exactly where curiosity strikes – directly inside the sentence flow, on demand, and without intrusive popups.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Conventional Explanation Patterns Fail on the Web
&lt;/h2&gt;

&lt;p&gt;Traditional user interfaces artificially detach reading from explaining through disruptive UI barriers. Jakob Nielsen (Nielsen Norman Group) characterized this dilemma in his foundational principles of &lt;em&gt;Progressive Disclosure&lt;/em&gt;: Users demand simplicity and scannability, but specialized scenarios demand granular details. Conventional patterns fail to solve this tradeoff:&lt;/p&gt;

&lt;p&gt;### 1. Tooltips &amp;amp; Hovercards (Touch Blind Spot)&lt;br&gt;
Touchscreens have no native hover state. Tooltips obscure subsequent lines, vanish at the slightest finger twitch, and are frustrating for users with motor impairments.&lt;br&gt;
  ### 2. Modal Dialogs (Cognitive Break)&lt;br&gt;
Popups violently tear readers out of their reading environment. Closing the modal forces readers to search and re-locate their sentence position.&lt;br&gt;
  ### 3. Accordions &amp;amp; Footnotes (Layout Jumps)&lt;br&gt;
Accordions dissect coherent prose into jagged blocks. Footnotes force an exhaustive scroll marathon to the bottom of the page and back.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Three Tiers of Adaptive Information Depth
&lt;/h3&gt;

&lt;p&gt;Explainable Text resolves the fundamental dilemma of technical writing: Who are we writing for? The hurried executive or the inquisitive beginner? Progressive disclosure inside sentences lets one document serve both:&lt;/p&gt;

&lt;p&gt;### Tier 1: The Scanner (Concise Lead)&lt;br&gt;
Skims the prose linearly in 15 seconds. Digests punchy sentences and grasps the core verdict without cognitive overhead.&lt;br&gt;
  ### Tier 2: The Inspector (Selective Depth)&lt;br&gt;
Clicks specifically on two ambiguous figures (e.g., acoustic decibels or FDM method) and gains instant context without tab switching.&lt;br&gt;
  ### Tier 3: Recursive Nesting (Deep Exploration)&lt;br&gt;
Expands secondary nested explanations (e.g., print speed ➔ 600 mm/s ➔ comparison to 50 mm/s baseline) right inside the expanded phrase.&lt;/p&gt;


&lt;h2&gt;
  
  
  Prerequisites and Technical Implementation
&lt;/h2&gt;

&lt;p&gt;What does a robust implementation in a modern web stack require? A semantic HTML trigger, type-safe token parsers, and a high-performance animation engine form the foundation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend Framework:&lt;/strong&gt; React 19 / Next.js with TypeScript for type-safe token parsers and recursive tree rendering.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Animation Engine:&lt;/strong&gt; CSS Transitions, Framer Motion, or lightweight character streaming via &lt;code&gt;requestAnimationFrame&lt;/code&gt; / &lt;code&gt;setTimeout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic HTML:&lt;/strong&gt; Accessible button triggers (&lt;code&gt;&amp;lt;button type="button"&amp;gt;&lt;/code&gt;) with synchronized ARIA attributes for screen readers.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Subtle Typography and Non-Linear Easing Ramps
&lt;/h3&gt;

&lt;p&gt;A clean dotted underline paired with a subtle right-facing chevron (&lt;code&gt;ChevronRight&lt;/code&gt;) minimizes visual noise. Utilizing non-linear accelerating easing, the typewriter animation begins at a deliberate 32 ms and accelerates dynamically down to 4 ms:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nc"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;useEffect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ChevronRight&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"lucide-react"&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="nc"&gt;ExplainableInline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;term&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;explanation&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;variant&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"subtle"&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="n"&gt;term&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;explanation&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;variant&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="s2"&gt;"subtle"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"badge"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&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;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;displayed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setDisplayed&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fullText&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;` (${explanation})`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;setDisplayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&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;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;// Accelerating easing: starts visibly and accelerates dynamically&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;scheduleNext&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nf"&gt;setDisplayed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fullText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cur&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;fullText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;progress&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;fullText&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;28&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nb"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;scheduleNext&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;delay&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;span class="nf"&gt;scheduleNext&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;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fullText&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;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"inline"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;
        &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt;
        &lt;span class="n"&gt;onClick&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="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setIsExpanded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;aria&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;expanded&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="n"&gt;variant&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"subtle"&lt;/span&gt;
            &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"inline-flex items-center gap-1 border-b-2 border-rose-500 font-semibold text-neutral-900 dark:text-white hover:text-rose-600 transition-colors cursor-pointer mx-0.5 px-0.5"&lt;/span&gt;
            &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 mx-0.5 font-semibold text-rose-700 bg-rose-500/10 border border-rose-500/25 transition-all cursor-pointer"&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;term&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChevronRight&lt;/span&gt;
          &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sb"&gt;`h-3 w-3 text-rose-500 transition-transform duration-200 ${
            isExpanded ? "rotate-180 text-rose-600 dark:text-rose-400" : ""
          }`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;isExpanded&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"inline text-neutral-750 dark:text-neutral-250 font-normal"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;displayed&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;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;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Rendering Performance &amp;amp; 60 FPS&lt;/strong&gt;&lt;br&gt;
During character streaming, every character triggers a component re-render. Keep state strictly local inside the &lt;code&gt;ExplainableInline&lt;/code&gt; component so parent paragraphs or the broader DOM tree never re-render. This keeps INP latency below 16 milliseconds.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Interactive Studio: Experience Explainable Text Hands-On
&lt;/h2&gt;

&lt;p&gt;How does Explainable Text feel with real content? The following workbench allows you to test streaming velocities, easing curves, and multi-level nested terms directly. Choose an industry preset (3D Printing, Web Performance, or AI Synthesis) or input custom copy in &lt;code&gt;[term](explanation)&lt;/code&gt; markdown syntax:&lt;/p&gt;

&lt;p&gt;The experiment highlights two crucial traits: Accelerating easing guides the eye intuitively along the sentence flow, while inline line wraps adapt naturally without jarring layout shifts in surrounding blocks.&lt;/p&gt;




&lt;h2&gt;
  
  
  Accessibility &amp;amp; Web Standards: WAI-ARIA APG and WCAG 2.2
&lt;/h2&gt;

&lt;p&gt;For accessible web applications, Explainable Text must satisfy rigorous accessibility criteria according to the W3C WAI-ARIA Authoring Practices Guide (APG) Disclosure Pattern:&lt;/p&gt;

&lt;p&gt;### WCAG Criterion 1.4.13 (Content on Hover/Focus) (a11y Level AA)&lt;br&gt;
Content must not appear purely on mouse hover. An explicit click or keyboard trigger (&lt;code&gt;[Enter]&lt;/code&gt;/&lt;code&gt;[Space]&lt;/code&gt;) guarantees that users digest explanations at their own reading pace.&lt;br&gt;
  ### WCAG Criterion 2.5.5 / 2.5.8 (Target Size) (Ergonomics)&lt;br&gt;
Despite compact typography, clickable hit areas must span at least 24 × 24 px (Level AA), preferably 44 × 44 px (Level AAA) via invisible pseudo-padding (&lt;code&gt;before:absolute&lt;/code&gt;) to prevent touch errors.&lt;/p&gt;

&lt;p&gt;Additionally, the CSS media query &lt;code&gt;prefers-reduced-motion&lt;/code&gt; must be respected: Users with reduced motion preferences receive the explanation immediately without typewriter animations.&lt;/p&gt;




&lt;h2&gt;
  
  
  SEO, GEO &amp;amp; Crawlability: Are Inline Expansions Indexed?
&lt;/h2&gt;

&lt;p&gt;Will search engines (Googlebot) or generative AI search engines (Perplexity, ChatGPT, Claude) index content behind inline clicks? Mobile-first indexing and Generative Engine Optimization (GEO) require clean separation of presentation and crawler accessibility:&lt;/p&gt;

&lt;p&gt;### Googlebot &amp;amp; Mobile-First Indexing (SEO Standard)&lt;br&gt;
Under Mobile-First Indexing, accordion and expandable content is &lt;strong&gt;fully indexed&lt;/strong&gt;. Google Search Central affirmed: As long as text resides in the DOM and is available to users on interaction, it receives full ranking weight without penalties.&lt;br&gt;
  ### GEO &amp;amp; RAG Pipelines (LLMs) (AI Search)&lt;br&gt;
AI search crawlers (like GPTBot, PerplexityBot, or Claude) rarely simulate button clicks. To ensure vector databases retain detailed explanations, our build pipeline automatically transforms `&lt;code&gt;tags into linear markdown&lt;/code&gt;term (explanation)&lt;code&gt;for&lt;/code&gt;llms.txt`.&lt;/p&gt;

&lt;h3&gt;
  
  
  Retaining DOM Content: Why Pure Client-Side Hiding Fails
&lt;/h3&gt;

&lt;p&gt;A common architectural anti-pattern in React apps is conditional rendering: &lt;code&gt;{isExpanded &amp;amp;&amp;amp; &amp;lt;span&amp;gt;{text}&amp;lt;/span&amp;gt;}&lt;/code&gt;. In server-rendered HTML (SSR/SSG), the text simply does not exist for initial crawlers.&lt;/p&gt;

&lt;p&gt;The solution mirrors the HTML5 disclosure pattern: Explanation copy is retained in the DOM from second zero – hidden via &lt;code&gt;aria-hidden="true"&lt;/code&gt; and an invisible anchor (&lt;code&gt;data-seo-content="true"&lt;/code&gt;), bound to the button's &lt;code&gt;aria-controls&lt;/code&gt; ID:&lt;/p&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;html&lt;/p&gt;

&lt;p&gt;&lt;br&gt;
  FDM technology&lt;br&gt;
&lt;br&gt;
&lt;span id="exp-fdm"&gt;&lt;br&gt;
  (Fused Deposition Modeling: Additive manufacturing method extruding melted thermoplastic filament...)&lt;br&gt;
&lt;/span&gt;&lt;br&gt;
&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;h3&gt;
  
  
  Inline Expansion vs. Block Accordion: When to Use Which?
&lt;/h3&gt;

&lt;p&gt;Standard HTML accordions (&lt;code&gt;&amp;lt;details&amp;gt;&amp;lt;summary&amp;gt;&lt;/code&gt;) are block elements. They break paragraphs and suit FAQs or discrete sections. For running sentences, metrics, and terminology, block accordions shatter reading cadence. Explainable Text serves as the &lt;strong&gt;typographic inline counterpart&lt;/strong&gt; (Inline Progressive Disclosure) – optimized for sentence rhythm, micro-interactions, and zero layout shift (CLS = 0).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Zero Cloaking Risk Under Google Guidelines&lt;/strong&gt;&lt;br&gt;
Google only penalizes hidden text when websites attempt to deceive crawlers with content not available to real users (e.g., white text on white backgrounds or hidden keyword spam). Because the semantic button trigger declares the term and user interaction reveals the exact text in the DOM, Explainable Text aligns 100% with W3C WAI-ARIA Disclosure standards and Google Search Essentials.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  AI Agent Prompt: Integrating Explainable Text in Your Project
&lt;/h2&gt;

&lt;p&gt;Copy this prompt into your AI coding assistant (Claude Code, Cursor, Antigravity) to build accessible, high-performance Explainable Text components compliant with W3C WAI-ARIA Disclosure standards and CLS=0:&lt;/p&gt;

&lt;h4&gt;
  
  
  🤖 Explainable Text Integration Prompt (Ziel: Claude / Cursor / Antigravity)
&lt;/h4&gt;

&lt;p&gt;`&lt;code&gt;&lt;/code&gt;markdown&lt;br&gt;
You are an expert UI/UX and Frontend Architect. Implement an Explainable Text component in React with Tailwind CSS.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create an ExplainableInline component using a native button trigger, aria-expanded, aria-controls, and accessible keyboard support ([Enter]/[Space]).&lt;/li&gt;
&lt;li&gt;Implement fluid character streaming (14ms cadence) with a typography typing cursor and accelerating easing.&lt;/li&gt;
&lt;li&gt;Ensure 'prefers-reduced-motion' immediately displays full text without animations.&lt;/li&gt;
&lt;li&gt;Protect parent components from unnecessary re-renders via React.memo or atomic local state.&lt;/li&gt;
&lt;li&gt;Retain explanation text in SSR markup via an invisible aria-hidden DOM element for crawlers and SEO.
&lt;code&gt;&lt;/code&gt;`&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Architectural Best Practices: Do's &amp;amp; Don'ts
&lt;/h2&gt;

&lt;p&gt;#### Empfohlen (Do): Recommended (Best Practice)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accenting the trigger phrase semantically and visually before expansion

&lt;ul&gt;
&lt;li&gt;Using smooth character streaming with a subtle cursor for natural reading cadence&lt;/li&gt;
&lt;li&gt;Respecting 'prefers-reduced-motion' media query by bypassing typewriter animations&lt;/li&gt;
&lt;li&gt;Ensuring touch target hit areas of at least 44 pixels via invisible pseudo-padding&lt;/li&gt;
&lt;li&gt;Pre-rendering explanation text in SSR DOM for search crawler indexability
#### Vermeiden (Don't): Avoid (Anti-Pattern)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Relying on mouse-only hover triggers that fail on touchscreen devices

&lt;ul&gt;
&lt;li&gt;Re-rendering whole paragraphs on every character tick (layout thrashing)&lt;/li&gt;
&lt;li&gt;Inlining multi-paragraph novellas – inline expansions must remain punchy and focused&lt;/li&gt;
&lt;li&gt;Missing keyboard accessibility (using clickable &lt;code&gt;div&lt;/code&gt; instead of semantic &lt;code&gt;button&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Client-only conditional mounting that hides content from search crawlers&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Checklist: Explainable Text in Practice
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Semantic Button:&lt;/strong&gt; Trigger uses &lt;code&gt;&amp;lt;button type="button"&amp;gt;&lt;/code&gt; with synchronized &lt;code&gt;aria-expanded&lt;/code&gt; and &lt;code&gt;aria-controls&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Keyboard Support:&lt;/strong&gt; Fully navigable and togglable via &lt;code&gt;[Tab]&lt;/code&gt;, &lt;code&gt;[Enter]&lt;/code&gt;, and &lt;code&gt;[Space]&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Mobile Ergonomics:&lt;/strong&gt; Touch targets meet the 44-pixel minimum hit area requirement via pseudo-padding.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Layout Stability:&lt;/strong&gt; Expansion integrates smoothly into line wrapping (CLS = 0).&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Reduced Motion:&lt;/strong&gt; System preference for reduced motion skips streaming animations.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;SEO &amp;amp; Crawlability:&lt;/strong&gt; Content exists in server-rendered HTML and feeds into LLM RAG pipelines.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Official Specifications &amp;amp; Primary Sources
&lt;/h2&gt;

&lt;p&gt;Authoritative primary sources covering hypertext history, W3C accessibility, UX principles, and search indexing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://en.wikipedia.org/wiki/Stretchtext" rel="noopener noreferrer"&gt;Ted Nelson: StretchText &amp;amp; Hypertext Concepts (1967/1970)&lt;/a&gt;: The historical foundation of adaptive hypertext without forced context switches; see also &lt;a href="https://notes.andymatuschak.org/zPLUdgxrXo5z24ccuyz8YQ4" rel="noopener noreferrer"&gt;Andy Matuschak's StretchText Notes&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.nngroup.com/articles/progressive-disclosure/" rel="noopener noreferrer"&gt;Nielsen Norman Group: Progressive Disclosure (Jakob Nielsen, 2006)&lt;/a&gt;: Foundational UX principle of prioritizing attention and deferring secondary details upon request.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/" rel="noopener noreferrer"&gt;W3C WAI-ARIA Authoring Practices: Disclosure (Show/Hide) Pattern&lt;/a&gt;: Authoritative W3C specification for accessible collapsible controls and keyboard state handling.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/content-on-hover-or-focus.html" rel="noopener noreferrer"&gt;W3C WCAG 2.2: Criterion 1.4.13 (Content on Hover/Focus)&lt;/a&gt; &amp;amp; &lt;a href="https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html" rel="noopener noreferrer"&gt;Criterion 2.5.8 (Target Size Minimum)&lt;/a&gt;: Accessibility standards for interactive elements and mobile hit targets.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developers.google.com/search/docs/crawling-indexing/mobile/mobile-sites-mobile-first-indexing" rel="noopener noreferrer"&gt;Google Search Central: Mobile-First Indexing &amp;amp; Collapsible Content&lt;/a&gt;: Official documentation confirming complete indexing of expandable content preserved in the DOM.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Related Topics in the Digital Garden
&lt;/h2&gt;

&lt;p&gt;Explore adjacent concepts spanning typography, accessibility, and client-side performance:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://lukiluki.me/garden/ambient-mode" rel="noopener noreferrer"&gt;Ambient Mode &amp;amp; Color Schemes&lt;/a&gt;: While Explainable Text controls information density, Ambient Mode controls visual lighting and atmosphere without cognitive friction.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lukiluki.me/garden/performance-optimization" rel="noopener noreferrer"&gt;Frontend Performance &amp;amp; Core Web Vitals&lt;/a&gt;: Techniques to optimize DOM mutations and character streaming to keep INP under 50 ms and CLS = 0.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lukiluki.me/garden/accessibility" rel="noopener noreferrer"&gt;Web Accessibility &amp;amp; Standards&lt;/a&gt;: In-depth guide to screen reader semantics, focus rings, and European Accessibility Act compliance.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://lukiluki.me/garden/web-mcp" rel="noopener noreferrer"&gt;Web MCP – Browser-Native AI Tools&lt;/a&gt;: How web pages expose structured interactive tools for autonomous client-side AI agents.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/explainable-text" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>stretchtext</category>
      <category>microinteractions</category>
      <category>uiux</category>
      <category>inlineexpansion</category>
    </item>
    <item>
      <title>Optimizing Websites for AI (GEO) – Information Gain, Markdown Negotiation and Agent Readiness</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:40 +0000</pubDate>
      <link>https://dev.to/lnk1812/optimizing-websites-for-ai-geo-information-gain-markdown-negotiation-and-agent-readiness-cmj</link>
      <guid>https://dev.to/lnk1812/optimizing-websites-for-ai-geo-information-gain-markdown-negotiation-and-agent-readiness-cmj</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/geo" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Why do well-written developer articles get ignored by Perplexity, ChatGPT Search, or Google AI Overviews while a single forum thread containing a raw error log gets cited at the very top? Publishing the tenth overview tutorial on a standard web API only feeds large language models information they already hold in their pretraining weights. At the same time, deeply nested DOM trees, inline SVGs, and React hydration scripts consume up to 85 percent of an agent's context window over HTTP before the first paragraph of actual engineering content is even parsed.&lt;/p&gt;

&lt;p&gt;Generative Engine Optimization (GEO) pairs verifiable primary telemetry (Information Gain) with a machine-readable delivery architecture. Server-side content negotiation via &lt;code&gt;Accept: text/markdown&lt;/code&gt;, explicit JSON-LD entity graphs, and structured benchmark tables cut retrieval token overhead by over 80 percent and increase citation probability across RAG answer engines. However, &lt;code&gt;/llms.txt&lt;/code&gt; or &lt;code&gt;.md&lt;/code&gt; routes never guarantee rankings on their own: without indexable HTML, empirical measurements, and documented failure boundaries, neural rerankers discard any page as redundant.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Information Gain Over Synthesis):&lt;/strong&gt;&lt;br&gt;
Language models synthesize textbook definitions on their own—they cite external websites only when those pages provide empirical metrics, documented failure modes, or configuration boundaries absent from pretraining weights. Technical protocols like Accept: text/markdown and JSON-LD ensure that this primary evidence reaches the model's context window without HTML noise.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Do RAG Pipelines Discard Classic Summaries—and How Does Information Gain Work?
&lt;/h2&gt;

&lt;p&gt;When a developer asks a technical question in Perplexity, ChatGPT Search, or Google AI Mode, the model runs a multi-stage RAG Pipeline (Retrieval-Augmented Generation: An architecture that retrieves relevant document chunks from a search index and injects them into the model prompt before generating a response.): the query is expanded into sub-queries (&lt;em&gt;query fan-out&lt;/em&gt;), candidate web pages are fetched, split into chunks, and scored by a Cross-Encoder Reranker (A neural scoring model that evaluates retrieved passages for factual density, evidence quality, and novelty before they enter the final LLM context.).&lt;/p&gt;

&lt;p&gt;Classic introductory paragraphs fail at this exact filter. A 400-word section explaining &lt;em&gt;"what the Model Context Protocol is"&lt;/em&gt; adds zero new entropy beyond the model's base weights. In information retrieval research and Google search patents, this differential value is called Information Gain (A measure of the novel, additive information a document provides compared to previously seen sources or pretraining knowledge.).&lt;/p&gt;

&lt;p&gt;The empirical study &lt;em&gt;GEO: Generative Engine Optimization&lt;/em&gt; (Aggarwal et al., Princeton University &amp;amp; Georgia Tech, KDD 2024) demonstrated across thousands of queries that three structural signals boost visibility in generative answers by &lt;strong&gt;30 to 40 percent&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Quantifiable Metrics Instead of Adjectives:&lt;/strong&gt; Concrete numbers with units (e.g., &lt;em&gt;"INP dropped from 280 ms to 42 ms"&lt;/em&gt; or &lt;em&gt;"Tool selection accuracy dropped by 64% beyond 23 registered MCP tools"&lt;/em&gt;) rather than vague claims.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documented Failure Modes &amp;amp; System Boundaries:&lt;/strong&gt; First-hand operational observations (&lt;em&gt;"On iOS 18 Safari, the WebGPU worker terminates with an Out-of-Memory error above 1.8 GB VRAM"&lt;/em&gt;). Models cannot hallucinate authentic hardware post-mortems—they must cite the primary source.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-Contained Citation Blocks &amp;amp; Comparison Tables:&lt;/strong&gt; Standalone 40–80 word answer paragraphs stating both mechanism and constraint, paired with Markdown tables sharing uniform evaluation criteria.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Four Technical Layers of an AI-Optimized Website
&lt;/h3&gt;

&lt;p&gt;To ensure primary engineering evidence isn't lost in DOM noise, &lt;code&gt;lukiluki.me&lt;/code&gt; combines four architectural layers:&lt;/p&gt;

&lt;p&gt;### 1. Primary Telemetry &amp;amp; Post-Mortems (Content)&lt;br&gt;
Every guide answers the core question in the first quarter (40–80 words) and backs claims with measured benchmarks, exact package versions, and reproducible failure boundaries.&lt;br&gt;
  ### 2. HTTP Content Negotiation (.md) (Transport)&lt;br&gt;
When an AI agent or CLI requests a route with &lt;code&gt;Accept: text/markdown&lt;/code&gt; or a &lt;code&gt;.md&lt;/code&gt; extension, &lt;code&gt;src/proxy.ts&lt;/code&gt; streams clean semantic Markdown stripped of navigation HTML and hydration scripts.&lt;br&gt;
  ### 3. Dense JSON-LD Entity Graphs (Semantics)&lt;br&gt;
A connected Schema.org &lt;code&gt;@graph&lt;/code&gt; (&lt;code&gt;TechArticle&lt;/code&gt;, &lt;code&gt;Person&lt;/code&gt;, &lt;code&gt;knowsAbout&lt;/code&gt;, &lt;code&gt;sameAs&lt;/code&gt;, &lt;code&gt;encoding&lt;/code&gt;) links author identity, technology entities, and the Markdown mirror in the document head.&lt;br&gt;
  ### 4. Semantic Accessibility Tree (Actuation)&lt;br&gt;
Strict ARIA roles, labeled form controls, and browser tools (&lt;a href="https://lukiluki.me/en/garden/web-mcp" rel="noopener noreferrer"&gt;Web MCP&lt;/a&gt;) allow autonomous browser agents to navigate interactive components without brittle DOM scraping.&lt;/p&gt;


&lt;h2&gt;
  
  
  What Infrastructure Do I Need to Implement Markdown Content Negotiation in Next.js 16?
&lt;/h2&gt;

&lt;p&gt;When a live retrieval bot such as &lt;code&gt;ChatGPT-User&lt;/code&gt;, &lt;code&gt;Perplexity-User&lt;/code&gt;, or &lt;code&gt;ClaudeBot&lt;/code&gt; fetches a standard React page, it receives full server HTML including navigation chrome, inline SVG icons, Tailwind utility strings, and serialized React Server Components payloads (&lt;code&gt;self.__next_f.push(...)&lt;/code&gt;).&lt;/p&gt;
&lt;h3&gt;
  
  
  Measured Payload Comparison on lukiluki.me: SSR HTML vs. Markdown Stream
&lt;/h3&gt;

&lt;p&gt;We measured actual byte payloads and estimated token counts (~4 characters per token) across five routes of this Digital Garden. The standard SSR HTML response carries roughly &lt;strong&gt;38.4 KB of layout and hydration shell overhead&lt;/strong&gt; before the article prose begins:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Garden Route on &lt;code&gt;lukiluki.me&lt;/code&gt;
&lt;/th&gt;
&lt;th&gt;SSR HTML Payload&lt;/th&gt;
&lt;th&gt;Estimated HTML Tokens&lt;/th&gt;
&lt;th&gt;Clean &lt;code&gt;.md&lt;/code&gt; Stream&lt;/th&gt;
&lt;th&gt;Estimated &lt;code&gt;.md&lt;/code&gt; Tokens&lt;/th&gt;
&lt;th&gt;Token Overhead Saved&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/garden/geo&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;54.8 KB&lt;/td&gt;
&lt;td&gt;~13,700 Tokens&lt;/td&gt;
&lt;td&gt;9.6 KB&lt;/td&gt;
&lt;td&gt;~2,400 Tokens&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-82.5%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/garden/web-mcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;51.2 KB&lt;/td&gt;
&lt;td&gt;~12,800 Tokens&lt;/td&gt;
&lt;td&gt;7.4 KB&lt;/td&gt;
&lt;td&gt;~1,850 Tokens&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-85.5%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/garden/brownfield-ai&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;56.4 KB&lt;/td&gt;
&lt;td&gt;~14,100 Tokens&lt;/td&gt;
&lt;td&gt;10.2 KB&lt;/td&gt;
&lt;td&gt;~2,550 Tokens&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-81.9%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/garden/3d-print-mcp&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;52.0 KB&lt;/td&gt;
&lt;td&gt;~13,000 Tokens&lt;/td&gt;
&lt;td&gt;7.8 KB&lt;/td&gt;
&lt;td&gt;~1,950 Tokens&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-85.0%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/garden/accessibility&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;49.6 KB&lt;/td&gt;
&lt;td&gt;~12,400 Tokens&lt;/td&gt;
&lt;td&gt;6.8 KB&lt;/td&gt;
&lt;td&gt;~1,700 Tokens&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;-86.3%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Prerequisites for Implementation
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Next.js App Router (v16.0+):&lt;/strong&gt; Request header inspection via &lt;code&gt;src/proxy.ts&lt;/code&gt; (Next.js 16 replaced &lt;code&gt;middleware.ts&lt;/code&gt; with &lt;code&gt;proxy.ts&lt;/code&gt;) paired with a Route Handler at &lt;code&gt;src/app/api/markdown/[slug]/route.ts&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-compiled Clean Markdown Corpus:&lt;/strong&gt; A prebuild step (using &lt;code&gt;gray-matter&lt;/code&gt;) that strips interactive client imports from MDX files and writes a clean JSON map.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP Discovery Headers:&lt;/strong&gt; &lt;code&gt;Vary: Accept&lt;/code&gt; (preventing CDN caches from serving raw Markdown to regular browsers) and &lt;code&gt;Link&lt;/code&gt; headers with &lt;code&gt;rel="alternate"; type="text/markdown"&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Real-World Failure Mode: Outdated Training Weights on Next.js 16 Proxy&lt;/strong&gt;&lt;br&gt;
If you prompt an LLM without local documentation context to write content negotiation for Next.js, it almost always generates a &lt;code&gt;middleware.ts&lt;/code&gt; file. Starting with Next.js 16, &lt;code&gt;middleware.ts&lt;/code&gt; is deprecated and renamed to &lt;code&gt;proxy.ts&lt;/code&gt; exporting &lt;code&gt;proxy(request: NextRequest)&lt;/code&gt;. Documenting such version-specific breaking changes provides high Information Gain.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Step-by-Step Implementation: &lt;code&gt;src/proxy.ts&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The production code below runs live on &lt;code&gt;lukiluki.me&lt;/code&gt;. It intercepts both explicit &lt;code&gt;/garden/[slug].md&lt;/code&gt; requests and standard article URLs carrying &lt;code&gt;Accept: text/markdown&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="c1"&gt;// src/proxy.ts (Next.js 16 File Convention)&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;NextResponse&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"next/server"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;NextRequest&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"next/server"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;prefersMarkdown&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/lib/ai-telemetry"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;siteUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;NEXT_PUBLIC_SITE_URL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;"https://lukiluki.me"&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;proxy&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="nc"&gt;NextRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;pathname&lt;/span&gt; &lt;span class="p"&gt;}&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="n"&gt;nextUrl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;acceptHeader&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="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"accept"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// 1. Direct .md suffix (e.g. /garden/geo.md or /en/garden/geo.md)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mdMatch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&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="o"&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;en&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;garden&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="o"&gt;^/&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="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;md&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mdMatch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;locale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mdMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"en"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"en"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"de"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mdMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rewriteUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/api/markdown/${slug}`&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="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rewriteUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searchParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"locale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;locale&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="nc"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rewrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rewriteUrl&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;// 2. HTTP Content Negotiation (Accept: text/markdown prioritized over text/html)&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;gardenMatch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pathname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&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="o"&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;en&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;garden&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="o"&gt;^/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gardenMatch&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nf"&gt;prefersMarkdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acceptHeader&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;locale&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gardenMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"en"&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="s2"&gt;"en"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"de"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gardenMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;rewriteUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`/api/markdown/${slug}`&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="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rewriteUrl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;searchParams&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"locale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;locale&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="nc"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rewrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rewriteUrl&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;// 3. Standard HTML delivery with HTTP discovery headers for AI agents&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;gardenMatch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;isEn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gardenMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"en"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;slug&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gardenMatch&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;mdHref&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sb"&gt;`${siteUrl}${isEn ? "/en" : ""}/garden/${slug}.md`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Vary"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Accept"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="s2"&gt;"Link"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="sb"&gt;`&amp;lt;${mdHref}&amp;gt;; rel="alternate"; type="text/markdown", &amp;lt;${siteUrl}/llms.txt&amp;gt;; rel="llms-txt"`&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;return&lt;/span&gt; &lt;span class="n"&gt;response&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;#### Empfohlen (Do): Idempotent Markdown with Vary: Accept and Canonical Metadata&lt;br&gt;
Always send &lt;code&gt;Vary: Accept&lt;/code&gt; and include the canonical URL, publication date, and author entity inside the Markdown header so context remains intact when an agent ingests only the &lt;code&gt;.md&lt;/code&gt; stream.&lt;br&gt;
  #### Vermeiden (Don't): User-Agent Cloaking with Divergent Claims for Search Bots&lt;br&gt;
Never serve factually different claims to &lt;code&gt;Googlebot&lt;/code&gt; than to human readers. Serving divergent content without transparent content negotiation violates search engine cloaking policies.&lt;/p&gt;




&lt;h2&gt;
  
  
  How Do I Audit Information Gain and Test Live Markdown Streaming?
&lt;/h2&gt;

&lt;p&gt;Use the interactive auditor below to test two mechanisms:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Top Panel (Information Gain Auditor):&lt;/strong&gt; Select one of the three presets or paste your own technical prose to evaluate token economy (SSR HTML vs. &lt;code&gt;.md&lt;/code&gt;), quantitative metrics, boundary signals, and banned marketing fluff.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bottom Terminal (Live Endpoint Tester):&lt;/strong&gt; Trigger a real &lt;code&gt;fetch&lt;/code&gt; request with &lt;code&gt;Accept: text/markdown&lt;/code&gt; against the live routes of this website (&lt;code&gt;/garden/geo.md&lt;/code&gt;, &lt;code&gt;/garden/web-mcp.md&lt;/code&gt;, etc.) and inspect the actual HTTP headers returned by &lt;code&gt;src/proxy.ts&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  What Does This Auditor Prove—and Where Are Its Limits?
&lt;/h3&gt;

&lt;p&gt;Comparing Preset 1 (&lt;em&gt;Empirical Post-Mortem&lt;/em&gt;) against Preset 2 (&lt;em&gt;Generic Summary&lt;/em&gt;) illustrates why retrieval pipelines filter out generic prose: Preset 2 contains zero extractable numbers and triggers marketing buzzword penalties, whereas Preset 1 provides concrete failure thresholds (&lt;code&gt;23 tools&lt;/code&gt;, &lt;code&gt;64%&lt;/code&gt;, &lt;code&gt;1.8 GB&lt;/code&gt;) and a machine-readable Markdown table.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitation:&lt;/strong&gt; The browser-side score is a &lt;strong&gt;structural heuristic&lt;/strong&gt;. It verifies whether formal building blocks for Information Gain exist, but cannot verify the factual accuracy of your benchmarks or external domain authority.&lt;/p&gt;




&lt;h2&gt;
  
  
  Which AI Crawler Reads What—and Why Does Google Ignore &lt;code&gt;/llms.txt&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;A common misconception is that dropping an &lt;code&gt;/llms.txt&lt;/code&gt; file into the root directory automatically ranks a site in Google AI Overviews. Server telemetry and official search documentation show a clear split across three crawler classes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Crawler / User-Agent&lt;/th&gt;
&lt;th&gt;Operator &amp;amp; Purpose&lt;/th&gt;
&lt;th&gt;Respects &lt;code&gt;robots.txt&lt;/code&gt;?&lt;/th&gt;
&lt;th&gt;Reads &lt;code&gt;/llms.txt&lt;/code&gt; Automatically?&lt;/th&gt;
&lt;th&gt;Preferred Format &amp;amp; Lever&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;Googlebot&lt;/code&gt; / &lt;code&gt;Google-Extended&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Google Search, AI Overviews &amp;amp; Gemini training&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (&lt;code&gt;Google-Extended&lt;/code&gt; only governs training, not search citations)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;No&lt;/strong&gt; (Google relies strictly on its regular HTML/DOM index)&lt;/td&gt;
&lt;td&gt;Server-rendered HTML (SSR), internal links, visible prose, and valid &lt;code&gt;TechArticle&lt;/code&gt; JSON-LD.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;OAI-SearchBot&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;OpenAI Search Index for ChatGPT Search&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Rarely&lt;/strong&gt; (Crawls sitemap &amp;amp; HTML pages)&lt;/td&gt;
&lt;td&gt;Clear question headings, comparison tables, and high factual density in the top quarter.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;ChatGPT-User&lt;/code&gt; / &lt;code&gt;Perplexity-User&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;User-initiated live fetch during a chat session&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Partially&lt;/strong&gt; (Treated as user-requested fetch)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes, when prompted&lt;/strong&gt; or via agent skills&lt;/td&gt;
&lt;td&gt;Benefits heavily from &lt;code&gt;Accept: text/markdown&lt;/code&gt; and fast TTFB.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;PerplexityBot&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Perplexity AI Citation Index (~10 sources per answer)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Rarely&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Strongly favors first-hand post-mortems, benchmark tables, and specific error fixes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;ClaudeBot&lt;/code&gt; / Claude Code&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Anthropic Web Index &amp;amp; Coding Agents&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Yes&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (Especially in developer documentation workflows)&lt;/td&gt;
&lt;td&gt;Direct &lt;code&gt;.md&lt;/code&gt; URLs (&lt;code&gt;/garden/geo.md&lt;/code&gt;), &lt;code&gt;/llms-full.txt&lt;/code&gt;, and versioned code blocks.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Verification Checklist: Is Your Website Ready for AI Search and Agents?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Information Gain Verified:&lt;/strong&gt; Does the article include at least one original measurement table, reproducible benchmark, or real-world failure post-mortem not found in boilerplate docs?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Direct Answer in First Quarter:&lt;/strong&gt; Is there a standalone 40–80 word paragraph right after the hook stating mechanism, benefit, and primary limitation without requiring any click?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Content Negotiation Active:&lt;/strong&gt; Does &lt;code&gt;curl -I -H "Accept: text/markdown" https://your-domain.com/path&lt;/code&gt; return &lt;code&gt;200 OK&lt;/code&gt; with &lt;code&gt;Content-Type: text/markdown; charset=utf-8&lt;/code&gt; and &lt;code&gt;Vary: Accept&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Retrieval Bots Allowed in &lt;code&gt;robots.txt&lt;/code&gt;:&lt;/strong&gt; Are &lt;code&gt;OAI-SearchBot&lt;/code&gt;, &lt;code&gt;ChatGPT-User&lt;/code&gt;, &lt;code&gt;PerplexityBot&lt;/code&gt;, &lt;code&gt;ClaudeBot&lt;/code&gt;, and &lt;code&gt;Googlebot&lt;/code&gt; explicitly allowed on article routes, &lt;code&gt;/llms.txt&lt;/code&gt;, and &lt;code&gt;/api/markdown/&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Entity Graph &amp;amp; Accessibility Tree:&lt;/strong&gt; Does the embedded &lt;code&gt;TechArticle&lt;/code&gt; JSON-LD validate cleanly, and do all interactive controls expose accessible labels and 44×44 px touch targets?&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Sources and Next Steps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Primary Sources &amp;amp; Research
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Aggarwal, P. et al. (2024):&lt;/strong&gt; &lt;a href="https://arxiv.org/abs/2311.09735" rel="noopener noreferrer"&gt;&lt;em&gt;GEO: Generative Engine Optimization&lt;/em&gt;&lt;/a&gt; – Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD '24), Princeton University, Georgia Tech &amp;amp; Allen Institute for AI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Search Central:&lt;/strong&gt; &lt;a href="https://developers.google.com/search/docs/appearance/ai-features" rel="noopener noreferrer"&gt;&lt;em&gt;AI features and your website (AI Overviews &amp;amp; AI Mode)&lt;/em&gt;&lt;/a&gt; – Official technical guidelines for indexing, structured data, and snippet controls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js 16.3 Documentation:&lt;/strong&gt; &lt;a href="https://nextjs.org/docs/app/guides/ai-agents" rel="noopener noreferrer"&gt;&lt;em&gt;How to set up your Next.js project for AI coding agents&lt;/em&gt;&lt;/a&gt; – Specification for &lt;code&gt;AGENTS.md&lt;/code&gt;, &lt;code&gt;.md&lt;/code&gt; routes, and &lt;code&gt;Accept: text/markdown&lt;/code&gt; content negotiation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Howard, J. / Answer.AI (2024):&lt;/strong&gt; &lt;a href="https://llmstxt.org/" rel="noopener noreferrer"&gt;&lt;em&gt;The /llms.txt Standard Proposal&lt;/em&gt;&lt;/a&gt; – Specification for curated Markdown indices for LLM context injection.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Related Digital Garden Tiles
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://lukiluki.me/en/garden/web-mcp" rel="noopener noreferrer"&gt;Web MCP – Tools for AI Agents in the Browser&lt;/a&gt;:&lt;/strong&gt; Explains how to go beyond text retrieval and expose deterministic JavaScript tools directly to browser AI agents via &lt;code&gt;navigator.modelContext&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://lukiluki.me/en/garden/brownfield-ai" rel="noopener noreferrer"&gt;Context Engineering with Obsidian &amp;amp; Graphify&lt;/a&gt;:&lt;/strong&gt; Shows how to apply structured knowledge graphs and &lt;code&gt;llms.txt&lt;/code&gt; principles to complex software repositories for coding agents.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/geo" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>geo</category>
      <category>llmstxt</category>
      <category>nextjs16</category>
      <category>jsonld</category>
    </item>
    <item>
      <title>Git Workflows – Branching, Rebasing and Release Strategies</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:29 +0000</pubDate>
      <link>https://dev.to/lnk1812/git-workflows-branching-rebasing-and-release-strategies-4f8o</link>
      <guid>https://dev.to/lnk1812/git-workflows-branching-rebasing-and-release-strategies-4f8o</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/git-workflows" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is Friday afternoon and a production bug needs a patch. The development branch already contains unfinished work from three tasks. A merge produces conflicts across dozens of files, CI turns red and nobody trusts the release button. Which branching rules would make this situation easier to handle?&lt;/p&gt;

&lt;p&gt;A Git workflow defines where changes start, how they are reviewed and how they reach the main branch and production. Trunk-based development favors frequent integration; feature branches organize review around a task; Gitflow separates development and release stages. The right choice depends on release needs and team coordination. Branch names alone provide no protection: review rules, reliable tests and a clear release process do the work.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Long-lived branches accumulate integration work. Keep changes small and integrate frequently enough that conflicts stay understandable.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Three common working models
&lt;/h2&gt;

&lt;p&gt;Git makes branches inexpensive, but teams still need a shared integration policy. The &lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows" rel="noopener noreferrer"&gt;Git book's branching workflows&lt;/a&gt; distinguish long-running branches from short-lived topic branches. These approaches can support several organizational models:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Typical structure&lt;/th&gt;
&lt;th&gt;Useful when&lt;/th&gt;
&lt;th&gt;Main tradeoff&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trunk-based development&lt;/td&gt;
&lt;td&gt;Integrate small changes frequently into &lt;code&gt;main&lt;/code&gt;, directly or through short-lived branches&lt;/td&gt;
&lt;td&gt;Automated checks support frequent delivery&lt;/td&gt;
&lt;td&gt;Incomplete functionality may need feature flags or smaller increments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Feature branch workflow&lt;/td&gt;
&lt;td&gt;One task branch, reviewed through a pull request&lt;/td&gt;
&lt;td&gt;Review is organized around individual changes&lt;/td&gt;
&lt;td&gt;Branches can drift if review or integration takes too long&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Gitflow&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;develop&lt;/code&gt;, &lt;code&gt;main&lt;/code&gt;, release and hotfix branches&lt;/td&gt;
&lt;td&gt;Distinct release lines need explicit coordination&lt;/td&gt;
&lt;td&gt;Fixes must reach every relevant branch; coordination increases&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;There is no universal branch lifetime that guarantees success. A team may aim to merge within a day or two, but oversized tasks and delayed reviews need attention too. Feature flags hide unfinished behavior; they do not remove the need to test integration or eventually remove stale flags.&lt;/p&gt;

&lt;h2&gt;
  
  
  How merge strategies shape history
&lt;/h2&gt;

&lt;p&gt;History affects debugging, review and reverting. Choose a policy that preserves the information your team needs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Strategy&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;When it helps&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Squash and merge&lt;/td&gt;
&lt;td&gt;A branch's changes become one new commit&lt;/td&gt;
&lt;td&gt;Keep one reviewed change together&lt;/td&gt;
&lt;td&gt;Individual branch commits are not preserved in the mainline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rebase and fast-forward&lt;/td&gt;
&lt;td&gt;Commits are replayed on a new base, then the branch pointer advances&lt;/td&gt;
&lt;td&gt;Keep a linear history&lt;/td&gt;
&lt;td&gt;Replaying commits changes their identities&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Merge commit&lt;/td&gt;
&lt;td&gt;A commit connects both histories&lt;/td&gt;
&lt;td&gt;Preserve branch integration points&lt;/td&gt;
&lt;td&gt;More merge nodes can make history harder to scan&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Rebase (Replay commits on a different base, creating new commit identities even when the changes are similar.) is useful for your own topic branch. Coordinate before rewriting commits that others already use. The &lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="noopener noreferrer"&gt;Git rebasing guide&lt;/a&gt; explains why rewriting shared history can create additional work for collaborators.&lt;/p&gt;

&lt;h3&gt;
  
  
  A short-lived feature branch
&lt;/h3&gt;

&lt;p&gt;This example assumes Git is installed, your worktree is clean, &lt;code&gt;origin&lt;/code&gt; is the intended remote and &lt;code&gt;main&lt;/code&gt; is the integration branch. Substitute your project's branch names. These commands illustrate a workflow; run project checks before review and follow its merge policy.&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;# Start from the current integration branch&lt;/span&gt;
git switch main
git pull --ff-only
git switch -c feature/account-help

&lt;span class="c"&gt;# After making the intended changes, inspect and commit them&lt;/span&gt;
git diff
git add path/to/changed-file
git commit -m &lt;span class="s2"&gt;"feat: improve account recovery help"&lt;/span&gt;

&lt;span class="c"&gt;# Update your own topic branch before review&lt;/span&gt;
git fetch origin
git rebase origin/main

&lt;span class="c"&gt;# Run the project's checks, then publish for a pull request&lt;/span&gt;
git push -u origin feature/account-help
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a rebase conflicts, inspect each affected file, resolve the intended result and continue with &lt;code&gt;git rebase --continue&lt;/code&gt;. Use &lt;code&gt;git rebase --abort&lt;/code&gt; to return to the pre-rebase state if needed. After resolving conflicts, run the checks again: a conflict-free merge does not prove correct behavior.&lt;/p&gt;

&lt;p&gt;For an emergency patch, start from the actual production revision and decide how the fix reaches ongoing development too. Do not assume that today's &lt;code&gt;main&lt;/code&gt; always matches the deployed version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Automation and branch protection
&lt;/h2&gt;

&lt;p&gt;Local hooks can run formatting, linting or targeted checks before a commit. They improve feedback but can be bypassed, so they do not replace required server-side checks. A CI (Continuous Integration: Automated checks run when changes are submitted or integrated, so failures are detected early.) pipeline should exercise the behavior that matters for the change.&lt;/p&gt;

&lt;p&gt;Use repository rules to enforce the chosen review and check requirements. Keep a documented exception process for urgent fixes rather than relying on informal direct pushes. Conventional Commit prefixes such as &lt;code&gt;feat:&lt;/code&gt; and &lt;code&gt;fix:&lt;/code&gt; can support changelog tooling when the repository is configured for them; the naming convention itself does not generate a release.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Short branch cycles need reliable checks&lt;/strong&gt;&lt;br&gt;
A quick merge process depends on trustworthy regression tests. &lt;a href="https://lukiluki.me/en/garden/testing" rel="noopener noreferrer"&gt;Frontend Testing&lt;/a&gt; explains how unit, integration and browser tests contribute different evidence.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Workflow checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Define the integration branch, production revision and route for emergency fixes.&lt;/li&gt;
&lt;li&gt;[ ] Make review and required checks explicit in repository rules.&lt;/li&gt;
&lt;li&gt;[ ] Keep changes small and investigate branches that repeatedly miss the team's integration target.&lt;/li&gt;
&lt;li&gt;[ ] Choose a merge policy and coordinate before rewriting shared commits.&lt;/li&gt;
&lt;li&gt;[ ] After integration, remove obsolete branches and ensure fixes reach every supported release line.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Branching-Workflows" rel="noopener noreferrer"&gt;Git book: Branching workflows&lt;/a&gt; – long-running and topic branches.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing" rel="noopener noreferrer"&gt;Git book: Rebasing&lt;/a&gt; – replaying commits and the risks of rewriting shared history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://lukiluki.me/en/garden/testing" rel="noopener noreferrer"&gt;Testing&lt;/a&gt; covers technical acceptance checks. &lt;a href="https://lukiluki.me/en/garden/brownfield-ai" rel="noopener noreferrer"&gt;Context Engineering&lt;/a&gt; explains how decision notes can preserve the reasons behind a repository's workflow.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/git-workflows" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>trunkbased</category>
      <category>rebase</category>
      <category>cicd</category>
    </item>
    <item>
      <title>MDX – Markdown Meets React Components</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:20 +0000</pubDate>
      <link>https://dev.to/lnk1812/mdx-markdown-meets-react-components-54ed</link>
      <guid>https://dev.to/lnk1812/mdx-markdown-meets-react-components-54ed</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/mdx" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You are writing technical documentation in Markdown. Plain text works until the reader needs a calculator, a live example or a reusable warning box. Copying HTML fragments across articles makes them harder to maintain. How can a document stay readable while using the same components as the application?&lt;/p&gt;

&lt;p&gt;MDX combines Markdown with JSX, so documents can import and render React components. In the Next.js App Router, local MDX can participate in server rendering while interactive components live behind explicit client boundaries. This makes shared styling and focused interaction possible. The result still depends on the imported components: using MDX alone does not guarantee static output, type-safe metadata or zero client JavaScript.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Use Markdown for the learning path and components for tasks that need them. Keep interactive state in separate client components and check what reaches the browser.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How MDX works in the App Router
&lt;/h2&gt;

&lt;p&gt;The MDX compiler turns a document into JavaScript that renders React elements. Headings and paragraphs become elements; imported components appear where they are used in the document. The &lt;a href="https://mdxjs.com/docs/what-is-mdx/" rel="noopener noreferrer"&gt;MDX format guide&lt;/a&gt; explains the combination of Markdown, JSX, expressions and module imports.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;@next/mdx&lt;/code&gt;, Next.js processes local &lt;code&gt;.mdx&lt;/code&gt; files through its build pipeline. An RSC (React Server Component: A component evaluated on the server whose rendered output can be composed with interactive Client Components.) can render the document and include client components where needed. Client components still need their JavaScript and hydration; importing one does not make the entire surrounding article a client component.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Document element&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;What to verify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Markdown headings, paragraphs and lists&lt;/td&gt;
&lt;td&gt;Structure and readable explanations&lt;/td&gt;
&lt;td&gt;The rendered heading hierarchy and semantics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared component mapping&lt;/td&gt;
&lt;td&gt;Consistent design-system presentation&lt;/td&gt;
&lt;td&gt;Mapping does not introduce unnecessary client dependencies&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Imported client component&lt;/td&gt;
&lt;td&gt;State, event handlers or browser APIs&lt;/td&gt;
&lt;td&gt;The interaction works and has accessible controls&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Metadata and frontmatter&lt;/td&gt;
&lt;td&gt;Search, page titles and exports&lt;/td&gt;
&lt;td&gt;The project explicitly parses and validates the fields&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Map standard elements to the design system
&lt;/h2&gt;

&lt;p&gt;The App Router uses &lt;code&gt;mdx-components.tsx&lt;/code&gt; to define component mappings. This allows a Markdown code fence or heading to reuse a styled application component. &lt;a href="https://nextjs.org/docs/app/guides/mdx" rel="noopener noreferrer"&gt;Next.js documents this setup&lt;/a&gt;, including the required mapping file and local MDX imports.&lt;/p&gt;

&lt;p&gt;For example, a shared code component can provide syntax highlighting, a frame and a copy button for every article. Keeping that behavior in one place is easier to maintain than repeating styled HTML snippets. It also means the document inherits the behavior and client requirements of that shared component.&lt;/p&gt;

&lt;p&gt;Frontmatter (Metadata stored at the start of a document, often as YAML between delimiter lines; parsing and validation must be configured by the application.) is not automatically a validated schema. In this garden, a build script parses metadata and checks it with Zod before generating the index. That is project infrastructure on top of MDX.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep interaction in a separate component
&lt;/h2&gt;

&lt;p&gt;Before using this pattern, configure &lt;code&gt;@next/mdx&lt;/code&gt; and the component mapping for your Next.js project. The example assumes an App Router application with an &lt;code&gt;@/&lt;/code&gt; source alias. The component file is ordinary TSX; the article imports it rather than defining hooks inside the MDX document.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="s2"&gt;"use client"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react"&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;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;
      &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"button"&lt;/span&gt;
      &lt;span class="n"&gt;onClick&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="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;value&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="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"min-h-11 rounded-lg border px-4 py-2"&lt;/span&gt;
    &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nc"&gt;Clicks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="o"&gt;&amp;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;Save that component as &lt;code&gt;src/components/Counter.tsx&lt;/code&gt;. The corresponding article can then contain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Counter from "@/components/Counter";

## Try the example

Activate the button by mouse or keyboard and watch the count change.

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

&lt;/div&gt;



&lt;p&gt;The expected result is a heading, an explanatory paragraph and a button whose count changes. Build the page, then test the interaction in the browser. A successful MDX compilation alone does not verify keyboard behavior, layout stability or the correctness of a larger interactive tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use components where they improve the document
&lt;/h2&gt;

&lt;p&gt;Markdown is a good default for explanations, lists and comparison tables. A reusable callout helps when it gives a warning a clear role. An interactive tool is useful when inputs change real data or behavior. A collection of preset comparisons can usually remain a table.&lt;/p&gt;

&lt;p&gt;Keep large dependencies behind deliberate boundaries and load them when the reader needs them. Avoid placing client hooks directly in an article or importing an entire component catalog for one small example. Review the resulting bundle rather than assuming an island is free.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;One design system, multiple reading depths&lt;/strong&gt;&lt;br&gt;
Shared components can keep documentation consistent with the application. &lt;a href="https://lukiluki.me/garden/components-library" rel="noopener noreferrer"&gt;UI Components&lt;/a&gt; discusses component libraries, while &lt;a href="https://lukiluki.me/en/garden/explainable-text" rel="noopener noreferrer"&gt;Explainable Text&lt;/a&gt; shows how optional explanations can stay in the reading flow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  MDX checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Put state, event handlers and browser APIs in separate client files.&lt;/li&gt;
&lt;li&gt;[ ] Keep the page's H1 in its wrapper and use a coherent H2/H3 structure in the article.&lt;/li&gt;
&lt;li&gt;[ ] Parse metadata explicitly and validate it against the page configuration.&lt;/li&gt;
&lt;li&gt;[ ] Build the application, then test any imported interaction in a real browser.&lt;/li&gt;
&lt;li&gt;[ ] Inspect the text export so important explanations survive without JSX.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://mdxjs.com/docs/what-is-mdx/" rel="noopener noreferrer"&gt;MDX: What is MDX?&lt;/a&gt; – syntax, imports and embedded components.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://nextjs.org/docs/app/guides/mdx" rel="noopener noreferrer"&gt;Next.js: MDX guide&lt;/a&gt; – local integration and component mapping; check the guide for your installed version.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For shared UI choices, continue with &lt;a href="https://lukiluki.me/garden/components-library" rel="noopener noreferrer"&gt;UI Components&lt;/a&gt;. For optional depth within a paragraph, see &lt;a href="https://lukiluki.me/en/garden/explainable-text" rel="noopener noreferrer"&gt;Explainable Text&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/mdx" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mdx</category>
      <category>react</category>
      <category>servercomponents</category>
      <category>designsystem</category>
    </item>
    <item>
      <title>Offline AI in Web Apps – Embeddings, Chatbots and Local Models</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:12 +0000</pubDate>
      <link>https://dev.to/lnk1812/offline-ai-in-web-apps-embeddings-chatbots-and-local-models-4751</link>
      <guid>https://dev.to/lnk1812/offline-ai-in-web-apps-embeddings-chatbots-and-local-models-4751</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/offline-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You are on a train without a connection and want to find related articles in a digital garden like lukiluki or ask questions about saved content. Does the AI need to reach a server, or can the web app do the computation itself?&lt;/p&gt;

&lt;p&gt;Yes: web apps can calculate embeddings, perform semantic search and, with a suitable language model, run chatbots offline. Text classification, speech recognition and certain image tasks are possible too. The models run on your device. This requires an app that starts offline, plus locally available models, runtime files and content. Whether it works well depends on model quality, browser support, memory and computing power.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Offline AI needs three things at once: an app that can start, a model that can run locally and locally available data.&lt;br&gt;
  An installable app icon or a saved chat history is not enough.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How does a web app compute without an AI server?
&lt;/h2&gt;

&lt;p&gt;With local inference (An already trained model processes new inputs on your device; it is not retrained in the process.), the browser runs a pretrained model. Instead of sending a question to a cloud API, the interface passes it to a local model library. No API key is needed for the model computation. Downloading the app and model files usually requires a connection first; the prepared features can then work offline.&lt;/p&gt;

&lt;p&gt;Two common building blocks are &lt;a href="https://huggingface.co/docs/transformers.js/en/index" rel="noopener noreferrer"&gt;Transformers.js&lt;/a&gt; for text, image and audio tasks, and &lt;a href="https://webllm.mlc.ai/" rel="noopener noreferrer"&gt;WebLLM&lt;/a&gt; for local language models with a chat interface. They cannot load just any model: its architecture, file format and required operations must be supported by the library.&lt;/p&gt;

&lt;p&gt;WebAssembly (An executable binary format for browsers; AI runtimes can use it to perform calculations on the CPU, abbreviated WASM.) provides a CPU execution path. WebGPU (A browser interface that lets suitable programs use the graphics processor for general computation as well as graphics.) can use the GPU. Transformers.js supports both paths; WebLLM requires WebGPU. The presence of a browser API does not prove that a particular model runs on the device. You need to load the model and actually process an input.&lt;/p&gt;

&lt;p&gt;The interface stays more responsive when intensive computation runs in a separate Web Worker, outside the main thread. A Service Worker has a different primary purpose: it can serve saved app files during an offline start. &lt;a href="https://webllm.mlc.ai/docs/user/advanced_usage.html" rel="noopener noreferrer"&gt;WebLLM documents workers and model caches&lt;/a&gt;; &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Offline_and_background_operation" rel="noopener noreferrer"&gt;MDN explains offline startup with Service Workers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which AI features can work offline?
&lt;/h2&gt;

&lt;p&gt;The table describes technical possibilities with suitable models, rather than measured speeds or promises for every phone. Every row requires all necessary files to be available locally.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Works offline?&lt;/th&gt;
&lt;th&gt;Example in a web app&lt;/th&gt;
&lt;th&gt;Main limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Embeddings&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Turn articles or personal notes into numerical vectors&lt;/td&gt;
&lt;td&gt;Check language coverage and suitability of the embedding model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Semantic search&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;“Long loading time” finds an article about performance&lt;/td&gt;
&lt;td&gt;The query also needs a compatible vector&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Chatbot&lt;/td&gt;
&lt;td&gt;Yes, with a local language model&lt;/td&gt;
&lt;td&gt;Answer questions or write a draft&lt;/td&gt;
&lt;td&gt;The model must fit in memory; quality and speed vary&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Document chat&lt;/td&gt;
&lt;td&gt;Yes, if the entire pipeline is local&lt;/td&gt;
&lt;td&gt;Answer with references to saved articles&lt;/td&gt;
&lt;td&gt;Documents, search and the answer model must work without cloud services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Classification&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;Sort notes by topic&lt;/td&gt;
&lt;td&gt;The model must represent the intended categories meaningfully&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Summarization and translation&lt;/td&gt;
&lt;td&gt;With a suitable model&lt;/td&gt;
&lt;td&gt;Shorten or translate saved text&lt;/td&gt;
&lt;td&gt;Input length, language and quality depend on the model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Speech to text&lt;/td&gt;
&lt;td&gt;With a suitable audio model&lt;/td&gt;
&lt;td&gt;Transcribe a local recording&lt;/td&gt;
&lt;td&gt;Audio length, memory and compute time limit usage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Text to speech&lt;/td&gt;
&lt;td&gt;With a suitable speech model&lt;/td&gt;
&lt;td&gt;Read an article aloud&lt;/td&gt;
&lt;td&gt;The voice and required files must be available locally&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Image analysis&lt;/td&gt;
&lt;td&gt;With a suitable image model&lt;/td&gt;
&lt;td&gt;Classify images or detect objects&lt;/td&gt;
&lt;td&gt;Support applies to specific tasks and model architectures&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The &lt;a href="https://huggingface.co/docs/transformers.js/en/index" rel="noopener noreferrer"&gt;Transformers.js task overview&lt;/a&gt; covers feature extraction, classification, generation, audio and image tasks. For chat, WebLLM documents &lt;a href="https://webllm.mlc.ai/docs/user/basic_usage.html" rel="noopener noreferrer"&gt;model initialization and streamed responses&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do local embeddings and search work?
&lt;/h2&gt;

&lt;p&gt;Embeddings are numerical vectors produced from text by a model. For a digital garden, you first calculate vectors for article sections and store them locally alongside the text, title and link. A new search query goes through the same embedding process. The app then compares its vector with the saved vectors and displays matching passages.&lt;/p&gt;

&lt;p&gt;The crucial distinction: &lt;strong&gt;comparing vectors does not run the model again.&lt;/strong&gt; A small collection can be searched directly in the browser; a cloud vector database is not essential. For larger collections, memory requirements and an appropriate search index become more important.&lt;/p&gt;

&lt;p&gt;For public articles, you can generate document vectors during the website build. The browser then only needs to embed the query. Private notes, meanwhile, can be processed entirely on the device. In both cases, document and query vectors must come from the same compatible model space: the same model version, compatible preprocessing, dimensions and any query or document prefixes required by the model. Matching vector lengths alone are insufficient.&lt;/p&gt;

&lt;p&gt;An article index generated by a cloud model therefore cannot simply be reused with an arbitrary small local model. When you change models, document vectors need to be regenerated accordingly. For German articles, also test German queries and paraphrases; a model optimized for English is not a reliable default. &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;Embeddings – finding related content&lt;/a&gt; explains how vectors and similarity work together.&lt;/p&gt;

&lt;h2&gt;
  
  
  What else does an offline chatbot need?
&lt;/h2&gt;

&lt;p&gt;A chatbot needs a generative language model that produces its response piece by piece. An embedding model alone cannot do this. A locally running chat also does not automatically know your articles or current information from the internet.&lt;/p&gt;

&lt;p&gt;RAG (Retrieval-Augmented Generation: A search retrieves relevant passages that a language model receives as context for its response.) suits a chat about garden content: the app first finds suitable saved passages and passes them, along with the question, to the local language model. The answer should reference the passages it used. If there is no supporting source, the interface should make that clear. Even with relevant passages, answers can still be wrong.&lt;/p&gt;

&lt;p&gt;The running example would be: “How do I make my site faster?” is embedded locally, retrieves saved performance sections and is passed with those sections to the answer model. Search, context and response stay on the device. Current web research or an external tool still requires a connection.&lt;/p&gt;

&lt;p&gt;Beyond model files, chat needs additional working memory for computation and conversation context. A smaller download therefore does not mean the same amount of memory is used at runtime. Quantization (Model weights are stored using fewer bits; this can reduce file size and memory needs, but can also affect quality and hardware compatibility.) can help, but does not replace device testing. Keep conversation length and retrieved passages within the chosen model's context window.&lt;/p&gt;

&lt;p&gt;For a digital garden, local search is therefore a useful first step: it returns results that can be checked directly. An additional chat model is worthwhile when written answers offer a clear benefit and work well enough on the target devices. &lt;a href="https://lukiluki.me/garden/intuitive-search" rel="noopener noreferrer"&gt;Intuitive Search&lt;/a&gt; shows how to make search results understandable to people.&lt;/p&gt;

&lt;h2&gt;
  
  
  How do you make an app truly usable offline?
&lt;/h2&gt;

&lt;p&gt;Prepare the app on a secure origin, usually HTTPS in production and localhost during local development. Choose a supported model with an appropriate license and test it on your target devices. A manifest and installation as a PWA (Progressive Web App: A web app that may support installation among other features; offline capability must be implemented separately.) do not replace this preparation.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Save the app and content.&lt;/strong&gt; Make the entry page, required scripts, styles, fonts and selected articles available offline. Check direct visits and navigation between saved pages too. An already open tab is not sufficient evidence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prepare the complete model package.&lt;/strong&gt; This includes weights, tokenizer, configuration and required runtime files. Transformers.js can fetch models and WASM files from external hosts by default; &lt;a href="https://huggingface.co/docs/transformers.js/v3.8.1/custom_usage" rel="noopener noreferrer"&gt;local paths and remote loading can be configured&lt;/a&gt;. A file at your own URL only becomes available offline once it has actually been saved.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version local data.&lt;/strong&gt; Store text and vectors in IndexedDB, for example, a browser database for structured data. Use the model library's cache or the Cache API for suitable files. Version the model and index together so an update does not mix incompatible vectors.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check storage and readiness.&lt;/strong&gt; Display download progress, missing files and storage errors clearly. Report “ready offline” only after the full package has loaded and a test run has succeeded. Reset the status if data is deleted or incomplete.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Plan for failure.&lt;/strong&gt; If the model cannot run, saved articles and a simple text search should remain usable. Offer a cloud alternative only as an explicit choice when inputs would leave the device.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Browser storage is limited. Users or storage pressure can remove data; private browsing has additional restrictions. The Storage API can estimate usage and request persistent storage, but the browser decides whether to grant it. Personal data still needs an export option. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria" rel="noopener noreferrer"&gt;MDN describes storage quotas and eviction rules&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Local computation does not automatically mean privacy&lt;/strong&gt;&lt;br&gt;
Local inference needs no upload of your input. Analytics, error reports, synchronization or a cloud fallback can still transmit data. Check the entire data flow and make such transfers visible.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How do you verify the result without internet access?
&lt;/h2&gt;

&lt;p&gt;Test the prepared features in a production build. Record the browser, device, model version and quantization with your results. Measure loading times and response behavior on the actual target devices; WebGPU support alone cannot establish reliable performance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Start cold:&lt;/strong&gt; After full preparation, close the app, block network access and open it again. The entry page, saved articles and navigation must work.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Process new inputs:&lt;/strong&gt; Submit a previously unused query and, if applicable, a new chat question. New results must be generated; a saved history does not prove offline inference.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Check sources:&lt;/strong&gt; Test a German paraphrase about a saved topic and a question outside the collection. Results must be understandable; unsupported chat answers must not appear as established facts.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Check failures:&lt;/strong&gt; Test missing model files, deleted caches and an unsuitable device. Expect clear messages and readable content rather than an endless loading indicator.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Check network traffic and usability:&lt;/strong&gt; Inspect network traffic while connected too; local processing must not send inputs. Search and chat must remain usable on small screens and by keyboard, including while the model computes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;p&gt;These sources describe supported methods and prerequisites; they do not replace testing your model on your target devices.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://huggingface.co/docs/transformers.js/en/index" rel="noopener noreferrer"&gt;Transformers.js: Tasks and execution paths&lt;/a&gt; – available text, audio and image pipelines.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://huggingface.co/docs/transformers.js/v3.8.1/custom_usage" rel="noopener noreferrer"&gt;Transformers.js v3.8.1: Local models and runtime files&lt;/a&gt; – concrete configuration for a documented version; check the corresponding documentation for other versions.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://webllm.mlc.ai/docs/user/basic_usage.html" rel="noopener noreferrer"&gt;WebLLM: Chat and model initialization&lt;/a&gt; – loading and using a local answer model.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://webllm.mlc.ai/docs/user/advanced_usage.html" rel="noopener noreferrer"&gt;WebLLM: Workers and caching&lt;/a&gt; – moving computation off the main thread and storing model artifacts.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Offline_and_background_operation" rel="noopener noreferrer"&gt;MDN: Offline operation of web apps&lt;/a&gt; – serving app resources without a connection.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Storage_API/Storage_quotas_and_eviction_criteria" rel="noopener noreferrer"&gt;MDN: Browser storage and eviction rules&lt;/a&gt; – understanding quotas, persistence and data loss.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Explore &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;how embeddings work&lt;/a&gt; before building a search index, use &lt;a href="https://lukiluki.me/garden/intuitive-search" rel="noopener noreferrer"&gt;Intuitive Search&lt;/a&gt; to design understandable search results, and read our field report on &lt;a href="https://lukiluki.me/garden/browser-llms" rel="noopener noreferrer"&gt;Browser-LLMs in PWAs&lt;/a&gt; to understand the storage and quality trade-offs of local chat models.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/offline-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>transformersjs</category>
      <category>webllm</category>
      <category>webgpu</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Smart Suggestions – Helping Readers Take the Next Step</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:42:03 +0000</pubDate>
      <link>https://dev.to/lnk1812/smart-suggestions-helping-readers-take-the-next-step-15il</link>
      <guid>https://dev.to/lnk1812/smart-suggestions-helping-readers-take-the-next-step-15il</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/smart-suggestions" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After researching a coffee machine, you buy one. For the next three weeks, the shop recommends five more coffee machines. You might instead need beans, descaler or help adjusting the grind. Documentation can make the same mistake: suggesting more alternative tools after the reader has already chosen a solution.&lt;/p&gt;

&lt;p&gt;Context-aware suggestions use signals from the current task to offer a useful next action. Copying an installation command, reading a section or moving between related pages can inform a simple browser-side rule. These signals are clues, rather than proof of intent. Local processing can reduce data transfer, but neither guarantees privacy nor proves that a suggestion will help. Readers need clear choices and control over the feature.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Respect decisions the reader has already made. Suggest a useful next step and let the reader ignore, dismiss or reset it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Three foundations of helpful guidance
&lt;/h2&gt;

&lt;p&gt;A next-best action (A suggested next step chosen for the current context, such as testing after setup, rather than simply showing more content with the same tag.) focuses on progress through a task. It need not use a language model: explicit rules can be easier to inspect and maintain for a small documentation site.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Respect a decision:&lt;/strong&gt; Once a reader has chosen a component, complementary accessibility or icon guidance may help more than another list of component libraries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interpret signals cautiously:&lt;/strong&gt; A copy action can suggest implementation work, but it can also mean saving a note for later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect work steps:&lt;/strong&gt; Installation may lead to configuration, and implementation to testing. Show the relationship rather than presenting an unexplained recommendation.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The following examples are authored comparisons, not measured predictions from a recommendation engine.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reader's action&lt;/th&gt;
&lt;th&gt;A poorly timed suggestion&lt;/th&gt;
&lt;th&gt;A potentially useful next step&lt;/th&gt;
&lt;th&gt;Why it may help&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Choose a button component&lt;/td&gt;
&lt;td&gt;Five other button libraries&lt;/td&gt;
&lt;td&gt;Check keyboard focus and accessible naming&lt;/td&gt;
&lt;td&gt;Supports implementing the chosen component&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Copy setup code&lt;/td&gt;
&lt;td&gt;An introductory definition of the framework&lt;/td&gt;
&lt;td&gt;Verify the setup and inspect error handling&lt;/td&gt;
&lt;td&gt;Moves from reading to checking the result&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Read about image loading&lt;/td&gt;
&lt;td&gt;An unrelated history of the web&lt;/td&gt;
&lt;td&gt;Review image dimensions and formats&lt;/td&gt;
&lt;td&gt;Connects the topic to a concrete project check&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These are hypotheses to validate with readers. A task may already be complete, the next step may be irrelevant, or the user may prefer to explore alternatives. A suggestion should remain optional.&lt;/p&gt;

&lt;h2&gt;
  
  
  What browser signals can tell you
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Copy actions&lt;/strong&gt; can be recorded by the application when its own copy button is used. This does not require reading arbitrary clipboard contents. Store the minimum event needed, such as “setup example copied”, rather than the user's clipboard data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Section visibility&lt;/strong&gt; can indicate which part of a page was on screen. The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API" rel="noopener noreferrer"&gt;Intersection Observer API&lt;/a&gt; reports intersections with a viewport or ancestor. It does not establish that someone read or understood the text. Background tabs, interruptions and assistive-technology use make dwell time especially ambiguous.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigation order&lt;/strong&gt; can reveal a plausible connection between topics. Moving repeatedly between two pages may suggest missing context, but it could also be intentional comparison. Avoid turning a heuristic into a statement about what the user definitely wants.&lt;/p&gt;

&lt;p&gt;Session context (A limited record of relevant actions within the current visit, rather than a persistent identity or a cross-site behavior profile.) can support these rules. For example, after a setup-copy event, a rule may prioritize a verification guide. Its output should explain the connection in plain language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Local processing and privacy boundaries
&lt;/h2&gt;

&lt;p&gt;Keeping rules and signals in a tab can reduce the need for server-side tracking. Choose storage according to the intended lifetime and provide a reset action. In-memory state disappears when the document is replaced unless it is preserved elsewhere. &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage" rel="noopener noreferrer"&gt;&lt;code&gt;sessionStorage&lt;/code&gt;&lt;/a&gt; can survive reloads within a page session, so it is different from a temporary variable.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Design choice&lt;/th&gt;
&lt;th&gt;Potential benefit&lt;/th&gt;
&lt;th&gt;What still needs checking&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In-memory events&lt;/td&gt;
&lt;td&gt;Small scope and no persistent record by default&lt;/td&gt;
&lt;td&gt;Application lifetime and accidental forwarding to analytics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tab-scoped storage&lt;/td&gt;
&lt;td&gt;Preserve a small amount of context across reloads&lt;/td&gt;
&lt;td&gt;Retention, restoration behavior, access failures and reset&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local recommendation rules&lt;/td&gt;
&lt;td&gt;No server call needed to choose the suggestion&lt;/td&gt;
&lt;td&gt;Other scripts, logs or synchronization may still transmit events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Explicit dismissal and reset&lt;/td&gt;
&lt;td&gt;Give readers control over guidance&lt;/td&gt;
&lt;td&gt;Keyboard access and whether dismissed suggestions stay dismissed as intended&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Local processing does not by itself determine consent or legal obligations. Avoid collecting sensitive content or claiming that a particular storage technique makes an entire product compliant. Inspect the complete data flow and the rules that apply to the actual implementation.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Helpful guidance stays easy to ignore&lt;/strong&gt;&lt;br&gt;
Place a suggestion near a natural next step, without covering the article or interrupting a form. Explain why it appears and make dismissal straightforward.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  How to check whether suggestions help
&lt;/h2&gt;

&lt;p&gt;Start with a documented task and a small rule set. For an installation article, ask readers to set up the tool and verify it. Observe whether the suggested verification guide helps them finish, whether they dismiss it and where it becomes distracting. A click on a recommendation is not the same as successful task completion.&lt;/p&gt;

&lt;p&gt;Keep a default route through the documentation available even if the feature is disabled. Test navigation and dismissal with a keyboard. If evaluating timing or usefulness, report the actual study conditions rather than asserting a fixed millisecond response or a guaranteed productivity gain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Smart suggestions checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Connect each suggestion to a specific task and explain the relationship.&lt;/li&gt;
&lt;li&gt;[ ] Treat copy, visibility and navigation events as uncertain clues.&lt;/li&gt;
&lt;li&gt;[ ] Store only necessary signals and inspect every path by which they could leave the browser.&lt;/li&gt;
&lt;li&gt;[ ] Provide accessible dismissal, reset and an ordinary navigation alternative.&lt;/li&gt;
&lt;li&gt;[ ] Evaluate task completion and disruption, rather than recommendation clicks alone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API" rel="noopener noreferrer"&gt;MDN: Intersection Observer API&lt;/a&gt; – observing intersections, rather than reading intent.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage" rel="noopener noreferrer"&gt;MDN: sessionStorage&lt;/a&gt; – scope, lifetime and storage limitations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://lukiluki.me/garden/intuitive-search" rel="noopener noreferrer"&gt;Intuitive Search&lt;/a&gt; explores direct access to information when a reader already knows what they need. &lt;a href="https://lukiluki.me/en/garden/embeddings" rel="noopener noreferrer"&gt;Embeddings&lt;/a&gt; explains content similarity, which is a different signal from the next action in a task.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/smart-suggestions" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nextbestaction</category>
      <category>ondevice</category>
      <category>sessioncontext</category>
      <category>privacy</category>
    </item>
    <item>
      <title>Frontend Testing – Test Layers and Reliable CI</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:41:52 +0000</pubDate>
      <link>https://dev.to/lnk1812/frontend-testing-test-layers-and-reliable-ci-49bg</link>
      <guid>https://dev.to/lnk1812/frontend-testing-test-layers-and-reliable-ci-49bg</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/testing" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You change a seemingly harmless CSS class in the header and push the branch. Twenty minutes later, checkout is broken. Nobody manually tried the payment flow, and automated checks did not cover it. How do you catch important regressions without clicking through the whole application after every change?&lt;/p&gt;

&lt;p&gt;Frontend testing combines fast checks of isolated logic, component tests of user interactions and browser tests of critical journeys. Vitest, React Testing Library and Playwright address different parts of that strategy. Choose tests according to risk and the behavior they verify. A passing suite provides evidence for the cases it covers; it cannot guarantee correctness, accessibility or a fixed CI runtime for every project.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz (Key takeaway):&lt;/strong&gt;&lt;br&gt;
Test observable behavior from the user's perspective. Internal refactoring should not break a test unless the behavior it protects has changed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The three layers of a frontend test strategy
&lt;/h2&gt;

&lt;p&gt;The test pyramid is a planning model, rather than a mandatory ratio. Fast isolated checks give frequent feedback; broader tests check how pieces work together. The &lt;a href="https://testing-library.com/docs/guiding-principles/" rel="noopener noreferrer"&gt;Testing Library guiding principles&lt;/a&gt; favor interacting with the rendered DOM instead of component instances.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Typical tool&lt;/th&gt;
&lt;th&gt;What to verify&lt;/th&gt;
&lt;th&gt;What it does not establish&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Unit&lt;/td&gt;
&lt;td&gt;Vitest&lt;/td&gt;
&lt;td&gt;Calculations, transformations and isolated business rules&lt;/td&gt;
&lt;td&gt;The complete interface or real browser behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Component integration&lt;/td&gt;
&lt;td&gt;React Testing Library with a suitable test runner&lt;/td&gt;
&lt;td&gt;Labels, visible states and interactions between components&lt;/td&gt;
&lt;td&gt;Full browser layout or real backend integration when simulated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;End to end&lt;/td&gt;
&lt;td&gt;Playwright&lt;/td&gt;
&lt;td&gt;Critical flows such as sign-in, basket and checkout in a browser&lt;/td&gt;
&lt;td&gt;Every input, failure or supported device from one happy-path test&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A simulated DOM such as &lt;code&gt;jsdom&lt;/code&gt; is useful for many component tests, but it is not a full rendering engine. Layout, browser APIs and integrations may need real-browser checks. Keep that boundary visible when interpreting a green test run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architectural choices that make tests useful
&lt;/h2&gt;

&lt;p&gt;Use accessible roles and labels to locate controls when they reflect how people use the interface. Query a “Save” button by role and name rather than a styling class. This aligns tests with useful semantics, but finding a role alone does not audit contrast, keyboard behavior or all accessibility requirements.&lt;/p&gt;

&lt;p&gt;Mock external services where you need controlled responses, while keeping the application behavior under test real. A network mock can reproduce a timeout or rejected payment. If the entire interaction is replaced by mocks, the test may only confirm its own setup.&lt;/p&gt;

&lt;p&gt;Flaky tests (Tests that pass and fail without an intentional change to the behavior under test, often because timing, shared state or external dependencies are uncontrolled.) erode confidence. Investigate races, shared data, animation and environmental differences. A temporary quarantine should have an owner and a repair plan, rather than becoming a permanent ignored failure.&lt;/p&gt;

&lt;h3&gt;
  
  
  Wait for behavior, rather than sleeping
&lt;/h3&gt;

&lt;p&gt;Configure a Playwright test project and a test environment before applying this pattern. Replace the route and accessible labels with those in your application. It assumes a sign-in form and a controlled test account, not a live production login.&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;expect&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@playwright/test"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"shows a helpful error for missing sign-in details"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goto&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/sign-in"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"button"&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="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Sign in"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;exact&lt;/span&gt;&lt;span class="p"&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="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;click&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;await&lt;/span&gt; &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;page&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getByRole&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"alert"&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;toContainText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Enter your email"&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;This is an illustrative assertion for an application that renders that alert. Adapt it when native form validation prevents submission or your product uses another accessible error pattern. The important mechanism is waiting for an expected visible state. &lt;a href="https://playwright.dev/docs/best-practices" rel="noopener noreferrer"&gt;Playwright recommends web-first assertions&lt;/a&gt;, which retry until the assertion succeeds or times out, rather than arbitrary fixed delays.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keep feedback fast and failures explainable
&lt;/h2&gt;

&lt;p&gt;Run focused tests locally and a useful set of checks in CI. Parallel execution can shorten feedback, but only if tests are isolated and the environment has capacity. A target such as a few minutes is a team budget to measure, rather than a guaranteed property of a particular tool.&lt;/p&gt;

&lt;p&gt;For visual regression checks, control viewport, fonts, data and animations. Review the difference before accepting a new baseline. A changed screenshot can reveal a regression, but it cannot decide whether a design change was intended.&lt;/p&gt;

&lt;p&gt;Prioritize critical paths and error cases. Branch coverage can highlight untested code, but a percentage does not prove that assertions are meaningful. For calculations with serious consequences, explicitly test boundary values, invalid input and domain rules.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Combine automated and manual accessibility checks&lt;/strong&gt;&lt;br&gt;
Role-based queries can reveal missing names or incorrect semantics. They complement keyboard and assistive-technology checks described in &lt;a href="https://lukiluki.me/garden/accessibility" rel="noopener noreferrer"&gt;Accessibility&lt;/a&gt;; they do not replace them.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Frontend testing checklist
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Identify critical journeys and assign checks to the smallest useful test layer.&lt;/li&gt;
&lt;li&gt;[ ] Locate controls by meaningful roles, labels or visible text where appropriate.&lt;/li&gt;
&lt;li&gt;[ ] Wait for observable states and isolate test data instead of relying on fixed sleeps.&lt;/li&gt;
&lt;li&gt;[ ] Cover important failures and boundary conditions, then inspect what assertions actually verify.&lt;/li&gt;
&lt;li&gt;[ ] Measure CI duration and repair flaky tests before the team learns to ignore them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and next steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://testing-library.com/docs/guiding-principles/" rel="noopener noreferrer"&gt;Testing Library: Guiding principles&lt;/a&gt; – tests centered on rendered behavior.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://playwright.dev/docs/best-practices" rel="noopener noreferrer"&gt;Playwright: Best practices&lt;/a&gt; – isolation, locators and web-first assertions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://lukiluki.me/en/garden/git-workflows" rel="noopener noreferrer"&gt;Git Workflows&lt;/a&gt; explains where review and automated checks fit into integration. &lt;a href="https://lukiluki.me/garden/accessibility" rel="noopener noreferrer"&gt;Accessibility&lt;/a&gt; covers the usability checks that a test suite alone cannot establish.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/testing" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>vitest</category>
      <category>playwright</category>
      <category>testinglibrary</category>
      <category>ci</category>
    </item>
    <item>
      <title>Verifiable AI – Why Language Models Fail at a Wooden Box Without Working Steps and Cross-Checks</title>
      <dc:creator>Lukas Kopischke</dc:creator>
      <pubDate>Mon, 23 Nov 2026 17:41:36 +0000</pubDate>
      <link>https://dev.to/lnk1812/verifiable-ai-why-language-models-fail-at-a-wooden-box-without-working-steps-and-cross-checks-173h</link>
      <guid>https://dev.to/lnk1812/verifiable-ai-why-language-models-fail-at-a-wooden-box-without-working-steps-and-cross-checks-173h</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Originally published with interactive examples at &lt;a href="https://lukiluki.me/en/garden/verifiable-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You are standing at the hardware store timber cut counter and need six boards of 16 mm MDF for a sealed 4-liter speaker enclosure (Markaudio Pluvia 7.2 HD). On your phone, a state-of-the-art language model produces a complete cut list and a 45-minute assembly guide in seconds. Yet when you lay the cut boards out at home, the front and back panels stick out by exactly 3.2 cm like two unintended legs. When confronted, the AI first blames you ("You rotated the boards by 90°")—and only realizes four messages later, mid-sentence, that its own geometry can never close flush.&lt;/p&gt;

&lt;p&gt;Language models do not compute geometry using a spatial world model; they predict text tokens sequentially. When a model outputs a final dimension (&lt;code&gt;25.2 × 18.2 cm&lt;/code&gt;) directly inside a table cell without writing out the intermediate edge addition, it skips verifying which panel overlaps which. Furthermore, once an error sits in the chat context, the model stubbornly defends it while burying the user under verbose advice. Reliable answers require prompts that enforce inline working steps and explicit cross-checks (invariants).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Merksatz:&lt;/strong&gt;&lt;br&gt;
A bare AI result without its working steps is like a math test with only the final number: force language models to derive every dimension as a visible formula and prove the result via an explicit cross-check (invariant).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Does a Frontier Model Miscalculate a Simple Wooden Box?
&lt;/h2&gt;

&lt;p&gt;A sealed rectangular box made of six butt-jointed wooden panels looks like middle-school geometry. Yet generating a cut list exposes two fundamental traits of Autoregressive LLMs (Language models that predict each subsequent token statistically based on prior tokens, without constructing a verified spatial or mathematical plan in working memory beforehand.): the lack of an intrinsic 3D representation and skipping intermediate arithmetic inside tables.&lt;/p&gt;

&lt;p&gt;In this real-world case (designing a sealed enclosure for a &lt;em&gt;Markaudio Pluvia 7.2 HD&lt;/em&gt; full-range driver using 16 mm = 1.6 cm MDF), the model specified:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Target internal dimensions:&lt;/strong&gt; 15.0 cm (width) × 22.0 cm (height) × 13.5 cm (depth) = 4.455 liters gross volume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assembly rule specified by the model:&lt;/strong&gt; &lt;em&gt;"Top and bottom panels sit between the side walls; front and back baffles are glued flush across the entire front and back faces."&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this specification, the AI generated the following cut list at the hardware store:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Qty&lt;/th&gt;
&lt;th&gt;AI Cut Dimension&lt;/th&gt;
&lt;th&gt;Intended Role&lt;/th&gt;
&lt;th&gt;Actual Geometric Effect&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Front &amp;amp; Back&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;25.2 × 18.2 cm&lt;/td&gt;
&lt;td&gt;Glued flush onto front and back of the frame&lt;/td&gt;
&lt;td&gt;Height &lt;code&gt;22.0 + 2 × 1.6 = 25.2 cm&lt;/code&gt;, Width &lt;code&gt;15.0 + 2 × 1.6 = 18.2 cm&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Side Walls&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;22.0 × 13.5 cm&lt;/td&gt;
&lt;td&gt;Stand vertically, enclosing top and bottom&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Bug:&lt;/strong&gt; If top/bottom sit &lt;em&gt;between&lt;/em&gt; the sides, the outer frame height is only 22.0 cm!&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Top &amp;amp; Bottom&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;15.0 × 13.5 cm&lt;/td&gt;
&lt;td&gt;Clamped horizontally between the side walls&lt;/td&gt;
&lt;td&gt;Outer frame width grows to &lt;code&gt;15.0 + 2 × 1.6 = 18.2 cm&lt;/code&gt; (flush with front width)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  The Butt-Joint Fallacy: Algebra vs. Topology
&lt;/h3&gt;

&lt;p&gt;Computing the volume of a cuboid (&lt;code&gt;15.0 × 22.0 × 13.5 cm = 4.455 l&lt;/code&gt;) is simple algebra. Designing butt joints across three axes, however, requires Topology (The spatial relationship and connectivity rules between parts—specifically which panel runs full-length across a corner and which panel must be shortened by two wall thicknesses.): when four boards (two sides, top, bottom) form a perimeter frame of 13.5 cm depth, &lt;strong&gt;only one pair of panels&lt;/strong&gt; adds its thickness to the outer dimension of the other pair.&lt;/p&gt;

&lt;p&gt;When you place the 15.0 cm top and bottom boards &lt;strong&gt;between&lt;/strong&gt; the 22.0 cm side walls as instructed, twice the wall thickness (&lt;code&gt;2 × 1.6 cm = 3.2 cm&lt;/code&gt;) is added to the &lt;strong&gt;width&lt;/strong&gt; (&lt;code&gt;15.0 + 3.2 = 18.2 cm&lt;/code&gt;), &lt;strong&gt;not to the height&lt;/strong&gt;. The outer height of the frame remains the exact length of the side walls (22.0 cm), while the internal chamber height shrinks to &lt;code&gt;22.0 − 3.2 = 18.8 cm&lt;/code&gt; (reducing gross volume by 14.5% from 4.46 l to 3.81 l).&lt;/p&gt;

&lt;p&gt;Because the AI blindly added 3.2 cm to &lt;em&gt;both&lt;/em&gt; axes of the front and back panels (25.2 × 18.2 cm), placing them onto the 22.0 cm frame left a &lt;code&gt;25.2 − 22.0 = 3.2 cm&lt;/code&gt; overhang.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Does the AI Defend Its Wrong Dimensions Across Four Turns?
&lt;/h2&gt;

&lt;p&gt;Even more revealing than the initial arithmetic bug is how the model reacted when confronted with photos of the overhanging boards. Instead of checking the math, the conversation went through three failure modes documented in recent LLM research:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. In-Context Stubbornness (Defending Prior Context)
&lt;/h3&gt;

&lt;p&gt;When told that the assembled boards had two protruding "legs," the AI replied: &lt;em&gt;"The dimensions are correct, but you rotated the panels by 90° in two places."&lt;/em&gt; Even after further pushback, it insisted: &lt;em&gt;"The boards you picked up at the hardware store are not cut incorrectly."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As &lt;a href="https://arxiv.org/abs/2310.01798" rel="noopener noreferrer"&gt;Huang et al. (ICLR 2024)&lt;/a&gt; demonstrate, language models rarely succeed at intrinsic self-correction without an external verification signal. Once the flawed table is in the context window, Autoregressive Anchoring (The tendency of an autoregressive language model to treat its own prior statements in the same conversation as high-probability ground truth, generating rationalizations rather than falsifying them.) takes over: the model treats its initial numbers as fact and invents user assembly mistakes to explain away the discrepancy.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Thinking While Typing: The Mid-Sentence "Wait" Moment
&lt;/h3&gt;

&lt;p&gt;Only on the fourth turn did the model attempt to prove its claim by telling the user to place the 15.0 cm top and bottom panels &lt;strong&gt;on top of&lt;/strong&gt; rather than &lt;em&gt;between&lt;/em&gt; the 22.0 cm side walls. While writing out the addition token by token, the model caught itself mid-response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Height: 1.6 cm bottom + 22.0 cm side wall + 1.6 cm top = exactly 25.2 cm.
Width: 15.0 cm + flush edges = 15.0 cm inner width.
(If the top/bottom panels are 15.0 cm wide and sit on top/bottom,
the outer width is missing 2× 1.6 cm unless they overlap).
Wait – that is exactly where the flawed edge logic in my first table was:
If you put top/bottom between the sides, the outer width is 18.2 cm,
but the height is only 22.0 cm. If you put them on top, the height is 25.2 cm,
but the outer width is only 15.0 cm.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This mid-sentence realization exposes the underlying mechanism: when the AI wrote bare numbers (&lt;code&gt;25.2 × 18.2 cm&lt;/code&gt;) into its first table, no edge verification occurred. Only when forced to spell out the addition chain for both height &lt;strong&gt;and&lt;/strong&gt; width in text tokens did the contradiction surface in the context window.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Verbosity Bias and Sycophancy
&lt;/h3&gt;

&lt;p&gt;Why didn't a 3.2 cm error stand out immediately at the store? Because the AI wrapped three flawed table rows in over 250 words of unsolicited advice: damping wool tips, glue drying times, jigsaw instructions, and acoustic Q-factor calculations (&lt;code&gt;fc ≈ 108 Hz&lt;/code&gt;, &lt;code&gt;Qtc ≈ 0.84&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;Verbosity Bias (The RLHF-induced tendency of language models to produce overly long, polite, and technically embellished answers that project an illusion of competence.) widens the Generation-Verification Gap (The asymmetry between the near-zero effort required to generate fluent AI output and the high cognitive load required for a human to verify its correctness under time pressure.). And when the user finally solved the puzzle without sawing by rotating the boards 90° (using the 25.2 × 18.2 cm panels as left and right outer cheeks so the front, back, and top sat flush while leaving 3.2 cm legs at the bottom), the AI enthusiastically praised the workaround as an &lt;em&gt;"integrated stand for acoustic desk decoupling."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Interactive Butt-Joint &amp;amp; Invariant Inspector
&lt;/h2&gt;

&lt;p&gt;Use the simulator below to inspect why the three board pairs from the original AI list can never form a flush box, how the 90° workshop rescue works, and how the two mathematically verified cut lists resolve the edge invariants:&lt;/p&gt;

&lt;h3&gt;
  
  
  What Does This Comparison Show?
&lt;/h3&gt;

&lt;p&gt;First, the error in the original list (&lt;code&gt;22.0 cm&lt;/code&gt; side wall vs. &lt;code&gt;25.2 cm&lt;/code&gt; front baffle) becomes obvious the moment the third table column forces an &lt;strong&gt;explicit formula&lt;/strong&gt; next to the dimension. Second, scenario &lt;em&gt;"2. Realer Werkstatt-Rettungsbau"&lt;/em&gt; shows how human spatial reasoning outperformed the model: because the small panels (15.0 cm) plus two 22.0 cm panels (&lt;code&gt;2 × 1.6 cm&lt;/code&gt; thick) added up to exactly &lt;code&gt;15.0 + 3.2 = 18.2 cm&lt;/code&gt; in depth, the large 25.2 × 18.2 cm panels fit flush against the core as outer side cheeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Do You Force Language Models to Be Verifiable? (The Calculator Contract)
&lt;/h2&gt;

&lt;p&gt;In school math classes, a simple rule applied: &lt;strong&gt;a bare final number from a calculator gets zero points without the working steps.&lt;/strong&gt; With language models, enforcing this rule serves two purposes at once:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;For the model (in-place Chain-of-Thought):&lt;/strong&gt; Writing the explicit addition before the equals sign (&lt;code&gt;15.0 cm inner + 2 × 1.6 cm side = 18.2 cm&lt;/code&gt;) forces the model to condition its output token on the arithmetic expression rather than guessing a dimension.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For the human (5-second audit):&lt;/strong&gt; At the hardware store or in a code review, you cannot audit a bare number (&lt;code&gt;18.2 cm&lt;/code&gt;) without reconstructing the entire geometry in your head. You can audit &lt;code&gt;15.0 + 2 × 1.6 = 18.2 cm&lt;/code&gt; in two seconds.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;#### Empfohlen (Do): Proof-Carrying Output (Result + Formula + Cross-Check)&lt;br&gt;
Always require a dedicated formula column (&lt;code&gt;Inner ± n × Thickness = Cut&lt;/code&gt;) and a 3-line cross-check (invariant) at the end proving that outer dimensions and part counts match across all three axes. Ban introductory fluff.&lt;br&gt;
  #### Vermeiden (Don't): Open-Ended Prompts and Arguing in the Same Thread&lt;br&gt;
Never ask open questions ("What dimensions do I need for 16 mm?") without output constraints. When an output looks wrong, do not argue in the same chat ("Are you sure?"); open a fresh session or demand a Python verification script to break autoregressive anchoring.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Forcing Python Execution Over Text Guessing&lt;/strong&gt;&lt;br&gt;
Modern frontier models include a Python code execution sandbox, but mobile chat routers often skip it on casual prompts to save latency. Adding the explicit instruction &lt;strong&gt;"Compute and verify all dimensions via a Python script before answering"&lt;/strong&gt; forces deterministic execution instead of token-level guessing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Copyable Prompt Recipe for Verifiable Calculations &amp;amp; Cut Lists
&lt;/h3&gt;

&lt;p&gt;Use this prompt structure on mobile or desktop whenever you need cut lists, quantity takeoffs, or technical conversions that must be right on the first pass:&lt;/p&gt;
&lt;h3&gt;
  
  
  Deterministic Verification Script for Rectangular Enclosures (Python)
&lt;/h3&gt;

&lt;p&gt;When using a coding agent or an LLM with code execution, require a short verification script with hard &lt;code&gt;assert&lt;/code&gt; statements (Invariant (A condition that must hold true throughout a computation or transformation—such as the outer frame height equaling the height of the front baffle glued onto it.)). If an edge condition fails, the script raises an &lt;code&gt;AssertionError&lt;/code&gt; before any wood is cut:&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;dataclasses&lt;/span&gt; &lt;span class="k"&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;frozen&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;span class="kt"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt;
    &lt;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;
    &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;
    &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;verify_flush_speaker_box&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;inner_w_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inner_h_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;thickness_cm&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;float&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;top_between_sides&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;bool&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="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;CutBoard&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="s2"&gt;"""
    Computes a butt-jointed 6-panel cuboid (front/back glued on top of frame)
    and deterministically asserts all edge and volume invariants.
    """&lt;/span&gt;
    &lt;span class="n"&gt;two_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;thickness_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;outer_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inner_w_cm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;outer_h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inner_h_cm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;front_back&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;"Front &amp;amp; Back"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;count&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;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;outer_h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;outer_w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"({inner_h_cm} + 2×{thickness_cm}) × ({inner_w_cm} + 2×{thickness_cm})"&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;top_between_sides&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;sides&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;"Side Walls (full height)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;count&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;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;outer_h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"({inner_h_cm} + 2×{thickness_cm} = {outer_h}) × {inner_d_cm}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;top_bottom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;"Top &amp;amp; Bottom (in between)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;count&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;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_w_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{inner_w_cm} (inner width) × {inner_d_cm}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;frame_outer_h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt;
        &lt;span class="n"&gt;frame_outer_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;real_inner_h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;real_inner_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;sides&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;"Side Walls (in between)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;count&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;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_h_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"{inner_h_cm} (inner height) × {inner_d_cm}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;top_bottom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;CutBoard&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;"Top &amp;amp; Bottom (full width)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;count&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;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;outer_w&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;formula&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"({inner_w_cm} + 2×{thickness_cm} = {outer_w}) × {inner_d_cm}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;frame_outer_h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;frame_outer_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt;
        &lt;span class="n"&gt;real_inner_h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt;
        &lt;span class="n"&gt;real_inner_w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;two_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;frame_outer_h&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;front_back&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Height mismatch! Frame ({frame_outer_h} cm) != Front ({front_back.length_cm} cm)"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;frame_outer_w&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;front_back&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Width mismatch! Frame ({frame_outer_w} cm) != Front ({front_back.width_cm} cm)"&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width_cm&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width_cm&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Frame depth mismatch!"&lt;/span&gt;

    &lt;span class="n"&gt;target_vol_l&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inner_w_cm&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inner_h_cm&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&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;span class="n"&gt;real_vol_l&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;real_inner_w&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;real_inner_h&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;inner_d_cm&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&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;span class="k"&gt;assert&lt;/span&gt; &lt;span class="n"&gt;target_vol_l&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;real_vol_l&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;"Volume drift: {real_vol_l} l != {target_vol_l} l"&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;front_back&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sides&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;top_bottom&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  When Is a Verification Prompt Enough and When Do You Need Real Tools?
&lt;/h2&gt;

&lt;p&gt;Enforcing working steps and cross-checks makes errors visible, but it does not turn a language model into a CAD kernel:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task Category&lt;/th&gt;
&lt;th&gt;Risk Without Cross-Check&lt;/th&gt;
&lt;th&gt;Recommended Verification Method&lt;/th&gt;
&lt;th&gt;When a Dedicated Tool Is Superior&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Simple Cuboids, Quantities &amp;amp; Everyday Conversions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Forgotten edge deductions (&lt;code&gt;2 × d&lt;/code&gt;), unit errors, hidden assumptions&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Proof-Carrying Prompt:&lt;/strong&gt; Formula inside each table row + 3-line invariant check at the end&lt;/td&gt;
&lt;td&gt;A dedicated online cut-list calculator or spreadsheet is faster and deterministic for standard boxes.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multi-Part Cut Lists &amp;amp; 2D Sheet Nesting&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Saw blade kerf omitted, overlapping parts in 2D layout&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Code Execution (Python):&lt;/strong&gt; AI writes and runs a verification script with &lt;code&gt;assert&lt;/code&gt; invariants&lt;/td&gt;
&lt;td&gt;For 10+ parts or miter joints, parametric CAD tools (FreeCAD, OpenSCAD) and dedicated nesting optimizers are strictly superior.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Debugging a Flawed AI Output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;em&gt;Autoregressive Anchoring:&lt;/em&gt; AI defends its error and blames the user&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Fresh-Context Falsification:&lt;/strong&gt; Paste only the bare dimensions into a new chat to audit for mismatches&lt;/td&gt;
&lt;td&gt;Measuring the parts yourself and checking &lt;code&gt;A + 2 × d = B&lt;/code&gt; on a pocket calculator takes 15 seconds.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Checklist: 4-Point Audit Before Trusting AI Dimensions
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;Is the working formula next to every number?&lt;/strong&gt; If a table shows only final dimensions (&lt;code&gt;25.2 × 18.2 cm&lt;/code&gt;), require the inline derivation (&lt;code&gt;22.0 + 2 × 1.6 = 25.2 cm&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Are joint assumptions stated upfront?&lt;/strong&gt; Verify which panel pair runs through and which sits in between.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Does the 5-second mental cross-check pass?&lt;/strong&gt; Sum the inner dimension plus twice the wall thickness across each axis and verify it matches the mating panel.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;Start a new chat instead of arguing:&lt;/strong&gt; If parts do not fit physically, do not debate the model in the same thread—audit the raw numbers in a fresh context or via Python.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Sources and Next Steps
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2310.01798" rel="noopener noreferrer"&gt;Huang et al. (ICLR 2024): Large Language Models Cannot Self-Correct Reasoning Yet&lt;/a&gt; – Demonstrates why LLMs struggle to correct their own reasoning errors in-context without external feedback.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2201.11903" rel="noopener noreferrer"&gt;Wei et al. (NeurIPS 2022): Chain-of-Thought Prompting Elicits Reasoning in Large Language Models&lt;/a&gt; – Shows why generating explicit intermediate steps before the final answer reduces multi-step calculation errors.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2310.13548" rel="noopener noreferrer"&gt;Sharma et al. (ICLR 2024): Towards Understanding Sycophancy in Language Models&lt;/a&gt; – Explains why RLHF-trained models favor agreeable, verbose rationalizations over admitting errors.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://arxiv.org/abs/2006.14779" rel="noopener noreferrer"&gt;Bansal et al. (CHI 2021): Does the Whole Exceed its Parts? The Effect of AI Explanations on Complementary Team Performance&lt;/a&gt; – Empirical evidence on how verbose AI explanations induce human over-reliance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To see how overly long text explanations can be replaced by compact, on-demand inline disclosures in interfaces, read &lt;a href="https://lukiluki.me/garden/explainable-text" rel="noopener noreferrer"&gt;Explainable Text&lt;/a&gt;. To see how autonomous hardware agents use deterministic preflight gates and OpenSCAD code instead of raw LLM geometry in 3D printing, check out &lt;a href="https://lukiluki.me/garden/3d-print-mcp" rel="noopener noreferrer"&gt;3D Print MCP&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Read the original guide &amp;amp; explore the interactive playground on *&lt;/em&gt;&lt;a href="https://lukiluki.me/en/garden/verifiable-ai" rel="noopener noreferrer"&gt;lukiluki.me&lt;/a&gt;*&lt;em&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>verifiableai</category>
      <category>promptengineering</category>
      <category>chainofthought</category>
      <category>invariants</category>
    </item>
  </channel>
</rss>
