<?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>Forem: Francesco Marconi</title>
    <description>The latest articles on Forem by Francesco Marconi (@francesco_marconi_282058b).</description>
    <link>https://forem.com/francesco_marconi_282058b</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3556595%2F396ff24e-6825-405e-adbf-e05a683843ba.png</url>
      <title>Forem: Francesco Marconi</title>
      <link>https://forem.com/francesco_marconi_282058b</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/francesco_marconi_282058b"/>
    <language>en</language>
    <item>
      <title>Part 3 of 3 — Engineering Intent Series -- Inside the Machine: The ISL Build Pipeline</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Wed, 01 Apr 2026 01:09:48 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/inside-the-machine-the-isl-build-pipeline-3epp</link>
      <guid>https://forem.com/francesco_marconi_282058b/inside-the-machine-the-isl-build-pipeline-3epp</guid>
      <description>&lt;p&gt;In Part 1 we identified the problem. In Part 2 we dissected the spec format. Now we go inside the engine that transforms intent into production code — automatically, verifiably, and repeatably.&lt;/p&gt;

&lt;p&gt;This is the &lt;strong&gt;ISL Tooling Engine&lt;/strong&gt;. It has two distinct phases: &lt;strong&gt;Build&lt;/strong&gt; and &lt;strong&gt;Generate&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Phase 1: The Builder
&lt;/h2&gt;

&lt;p&gt;Real software is never a single file. A &lt;code&gt;LoginForm&lt;/code&gt; depends on &lt;code&gt;UserAuthService&lt;/code&gt;, which depends on &lt;code&gt;User&lt;/code&gt; domain model, which depends on &lt;code&gt;AuthStatus&lt;/code&gt; enum. Each of those has its own &lt;code&gt;.isl.md&lt;/code&gt; spec file.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;ISL Builder&lt;/strong&gt; scans your entire specification folder, identifies all &lt;code&gt;@Reference&lt;/code&gt; tags, and builds a &lt;strong&gt;Directed Acyclic Graph (DAG)&lt;/strong&gt; of your system:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AuthStatus (enum)
    └── User (domain model)
            └── UserAuthService (business logic)
                    └── LoginForm (presentation)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This graph is not documentation. It's the build order.&lt;/p&gt;

&lt;h3&gt;
  
  
  Topological Sort
&lt;/h3&gt;

&lt;p&gt;The Builder performs a &lt;strong&gt;topological sort&lt;/strong&gt; on this graph — the same technique used by real compilers, package managers (npm, cargo, gradle), and build systems like Make. The rule is simple: before processing any node, all its dependencies must already be resolved.&lt;/p&gt;

&lt;p&gt;To trigger the build phase and resolve the project graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ts-node tools/vscode-isl/src/isl-builder.ts example/design-pomodoro
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For each component, the Builder produces two files:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;xxx.build.md&lt;/code&gt;&lt;/strong&gt; — the full generation context: the original ISL spec of the component, with all the &lt;code&gt;.ref.md&lt;/code&gt; files of its dependencies inlined. This is the complete, self-contained instruction set for that component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;xxx.ref.md&lt;/code&gt;&lt;/strong&gt; — the public interface of the component: what it exports, what its capabilities are, what types it exposes. This is what downstream components will receive as context.&lt;/p&gt;

&lt;p&gt;Here's what a real &lt;code&gt;.ref.md&lt;/code&gt; looks like — from an actual ISL project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- INTERFACE (REF) FOR: logic.isl.md --&amp;gt;&lt;/span&gt;

&lt;span class="gh"&gt;# Project: Logic&lt;/span&gt;

&lt;span class="gs"&gt;**Version**&lt;/span&gt;: 1.0.0
&lt;span class="gs"&gt;**ISL Version**&lt;/span&gt;: 1.6.1

&lt;span class="c"&gt;&amp;lt;!-- IMPLEMENTATION PATH: ./logic --&amp;gt;&lt;/span&gt;
&lt;span class="gt"&gt;
&amp;gt; **Reference**: TimerMode, TimerState, TimerConfigEntity in `./domain.isl.md`&lt;/span&gt;

&lt;span class="gu"&gt;## Component: PomodoroEngine&lt;/span&gt;

&lt;span class="gu"&gt;### Role: Business Logic&lt;/span&gt;

&lt;span class="gu"&gt;### ⚡ Capabilities&lt;/span&gt;

&lt;span class="gu"&gt;#### initialize&lt;/span&gt;

&lt;span class="gs"&gt;**Contract**&lt;/span&gt;: Sets up the initial state of the timer
&lt;span class="gs"&gt;**Signature**&lt;/span&gt;: Input: None / Output: None

&lt;span class="gu"&gt;#### startTimer&lt;/span&gt;

&lt;span class="gs"&gt;**Contract**&lt;/span&gt;: Initiates the countdown for the current timer mode
&lt;span class="gs"&gt;**Signature**&lt;/span&gt;: Input: None / Output: None

&lt;span class="gu"&gt;#### selectMode&lt;/span&gt;

&lt;span class="gs"&gt;**Contract**&lt;/span&gt;: Changes the active timer mode and resets the timer
&lt;span class="gs"&gt;**Signature**&lt;/span&gt;:
&lt;span class="p"&gt;
-&lt;/span&gt; Input: &lt;span class="sb"&gt;`mode`&lt;/span&gt;: &lt;span class="sb"&gt;`TimerMode`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Output: None
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Builder also produces the &lt;strong&gt;Build Manifest&lt;/strong&gt; — a JSON index of all components in topological order, with their source paths, build paths, and integrity hashes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sourceFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/domain.isl.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/build/domain.build.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"implementationPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./domain"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"753ff32724b2a2501ab95b5241afbd48"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sourceFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/logic.isl.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/build/logic.build.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"implementationPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./logic"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"8b36f3559da223a04d77a5ccba40bfbd"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sourceFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/ui.isl.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/build/ui.build.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"implementationPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./ui"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"91d28e3dc2652d9d0f0590acf7f1583a"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sourceFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/main.isl.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"buildFile"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./pomodoro/build/main.build.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"implementationPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"./main"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"hash"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"72145c5ee3d89dac2a7f86f0047cb673"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the order: &lt;code&gt;domain&lt;/code&gt; first, then &lt;code&gt;logic&lt;/code&gt; (which depends on domain), then &lt;code&gt;ui&lt;/code&gt; (which depends on logic), then &lt;code&gt;main&lt;/code&gt; last. The topological sort guarantees this. The Generate phase will process them in exactly this sequence.&lt;/p&gt;




&lt;h2&gt;
  
  
  Phase 2: The Generator
&lt;/h2&gt;

&lt;p&gt;With the Build Manifest ready, the Generator processes each component &lt;strong&gt;in topological order&lt;/strong&gt; — because by the time it reaches any component, all its dependencies have already been compiled.&lt;/p&gt;

&lt;p&gt;For each component, the Generator receives exactly two inputs:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. &lt;code&gt;xxx.build.md&lt;/code&gt;&lt;/strong&gt; — the spec + inlined interfaces of all dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. &lt;code&gt;dep.sign.ts&lt;/code&gt; for each dependency&lt;/strong&gt; — the &lt;strong&gt;actual TypeScript signatures&lt;/strong&gt; generated in previous steps. Not the spec. Not the &lt;code&gt;.ref.md&lt;/code&gt;. The real, generated code signatures.&lt;/p&gt;

&lt;p&gt;Here's why this matters. The &lt;code&gt;.ref.md&lt;/code&gt; describes what a component &lt;em&gt;should&lt;/em&gt; expose according to the ISL spec. But the LLM that compiled it may have made idiomatic choices — wrapping a return type, using a language-native pattern, adjusting a signature slightly. The &lt;code&gt;sign.ts&lt;/code&gt; captures what was &lt;em&gt;actually generated&lt;/em&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;TimerMode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;TimerState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;TimerConfigEntity&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./domain&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;PomodoroEngine&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;initialConfig&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;workDuration&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;shortBreakDuration&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;longBreakDuration&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;initialize&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;startTimer&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;pauseTimer&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;resetTimer&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="k"&gt;void&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;selectMode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;TimerMode&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;TimerMode&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="nl"&gt;getCurrentState&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;typeof&lt;/span&gt; &lt;span class="nx"&gt;TimerState&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="kr"&gt;keyof&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;TimerState&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="nl"&gt;getRemainingTime&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="kr"&gt;number&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;When &lt;code&gt;LoginForm&lt;/code&gt; is compiled, it receives this exact signature — not what the spec said, but what the code &lt;em&gt;is&lt;/em&gt;. This eliminates integration mismatches structurally. The generated code is guaranteed to compile against the code that actually exists.&lt;/p&gt;

&lt;p&gt;To generate the implementation using a specific stack and LLM provider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ts-node tools/vscode-isl/src/isl-generator.ts example/design-pomodoro &lt;span class="nt"&gt;--gemini&lt;/span&gt; &lt;span class="nt"&gt;--v&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;31p &lt;span class="nt"&gt;--stack&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;react-js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Generator outputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;xxx.js&lt;/code&gt;&lt;/strong&gt; — the generated implementation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;xxx.sign.ts&lt;/code&gt;&lt;/strong&gt; — the actual signature of this component, ready for downstream consumers&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Phase 3: The Auditor (Verification)
&lt;/h2&gt;

&lt;p&gt;The pipeline doesn't end when the code is written. To ensure the implementation strictly follows the logical state transitions defined in the ISL, we trigger the &lt;strong&gt;Auditor&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The Auditor is a specialized agent that acts as a &lt;strong&gt;Deterministic Unit Test Runner&lt;/strong&gt;. It doesn't just look at the code; it simulates the "Flow" described in the spec against the generated logic. &lt;/p&gt;

&lt;p&gt;Its job is to catch &lt;strong&gt;Logical Dead-ends&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Is an &lt;code&gt;isLoading&lt;/code&gt; flag set but never reset in a &lt;code&gt;CATCH&lt;/code&gt; block?&lt;/li&gt;
&lt;li&gt;  Does a state transition skip a mandatory notification?&lt;/li&gt;
&lt;li&gt;  Is a method signature logically sound but practically unreachable?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The audit process happens in two steps: first generating the scenarios, then running the simulation.&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;# 1. Create the logical tests from the spec&lt;/span&gt;
npx ts-node tools/vscode-isl/src/isl-logic-test.ts example/design-pomodoro &lt;span class="nt"&gt;--gemini&lt;/span&gt; &lt;span class="nt"&gt;--v&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;31p

&lt;span class="c"&gt;# 2. Run the robotic auditor to verify the implementation&lt;/span&gt;
npx ts-node tools/vscode-isl/src/isl-logic-test-run.ts example/design-pomodoro &lt;span class="nt"&gt;--gemini&lt;/span&gt; &lt;span class="nt"&gt;--v&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;31p
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By running this verification automatically, we catch architectural bugs before a human developer even opens a Pull Request.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Full Pipeline
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.isl.md files
      │
      ▼
┌─────────────┐
│   BUILDER   │  DAG + topological sort
└─────────────┘
      │
      ├──► xxx.build.md   (ISL + inlined .ref.md of dependencies)
      ├──► xxx.ref.md     (public interface, for downstream specs)
      └──► manifest.json  (ordered build index + hashes)
      │
      ▼
┌─────────────┐
│  GENERATOR  │  processes in topological order
└─────────────┘
      │
      Input per component:
      ├── xxx.build.md
      └── dep.sign.ts  (real signatures of all dependencies)
      │
      Output per component:
      ├──► xxx.js        (generated implementation)
      └──► xxx.sign.ts   (real signature, for downstream generators)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every step is deterministic. Every component is compiled against real, already-generated interfaces. The output is not "what the AI felt like generating today." It's the inevitable result of compiling a precise specification against a verified dependency graph.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing the Loop
&lt;/h2&gt;

&lt;p&gt;Across these three articles, we've built the case for a fundamentally different way of working with AI in software development.&lt;/p&gt;

&lt;p&gt;Not prompt engineering. &lt;strong&gt;Spec engineering.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The shift is conceptually simple but practically significant: you stop treating the LLM as a creative collaborator you negotiate with, and start treating it as a compiler you feed precise input. The quality of the output stops depending on how well you phrase your request and starts depending on how well you define your intent.&lt;/p&gt;

&lt;p&gt;ISL is the language for that intent. The Tooling Engine is the compiler. The generated code is the artifact. And the spec — always in sync with the code, by construction — is the end of undocumented legacy software.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The spec is open source — read it, use it, contribute to it:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/fra00/isl-specification" rel="noopener noreferrer"&gt;github.com/fra00/isl-specification&lt;/a&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>llm</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Part 2 of 3 — Engineering Intent Series - Engineering Intent: The Anatomy of ISL</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Wed, 01 Apr 2026 01:08:46 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/engineering-intent-the-anatomy-of-isl-1bio</link>
      <guid>https://forem.com/francesco_marconi_282058b/engineering-intent-the-anatomy-of-isl-1bio</guid>
      <description>&lt;p&gt;In the first part of this series, we identified the "Ambiguity Tax" — the inherent cost of inconsistent code produced by treating LLMs as creative assistants rather than deterministic engines. Today, we dive into the anatomy of the solution: &lt;strong&gt;ISL (Intent Specification Language)&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Beyond Prompting: The Contract Layer
&lt;/h2&gt;

&lt;p&gt;Standard prompt engineering relies on "hope." You hope the model interprets your bullet points correctly. ISL shifts this paradigm by introducing a &lt;strong&gt;formal contract layer&lt;/strong&gt;. It's less like talking to a developer and more like writing an IKEA manual for software.&lt;/p&gt;

&lt;p&gt;An IKEA manual doesn't describe the molecular structure of the wood. It tells you:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;What parts&lt;/strong&gt; you must have (&lt;strong&gt;Domain&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What actions&lt;/strong&gt; to perform in which order (&lt;strong&gt;Capabilities &amp;amp; Flows&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How to verify&lt;/strong&gt; the result (&lt;strong&gt;Acceptance Criteria&lt;/strong&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Regardless of who reads the manual, the finished table looks exactly the same. The goal isn't byte-for-byte identical code — LLMs are still probabilistic — but &lt;strong&gt;reliable semantic consistency&lt;/strong&gt;. Same spec, same behavior, every time.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Three Pillars of an ISL Component
&lt;/h2&gt;

&lt;p&gt;Every ISL specification is built on three normative pillars, marked by semantic anchors that guide the LLM's reasoning:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. ⚡ Capabilities: The "What"
&lt;/h3&gt;

&lt;p&gt;Capabilities define observable behavior. Each capability includes a &lt;strong&gt;Contract&lt;/strong&gt;, a &lt;strong&gt;Trigger&lt;/strong&gt;, and a &lt;strong&gt;Flow&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The Flow describes logical state transitions in natural language — not algorithms. Instead of writing a loop, you specify: &lt;em&gt;"Calculate the final price including the regional tax rate."&lt;/em&gt; This allows the LLM to generate idiomatic code for the target language — TypeScript, Go, Python — while strictly adhering to the business rule.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. 🚨 Constraints: The Non-Negotiables
&lt;/h3&gt;

&lt;p&gt;ISL uses &lt;strong&gt;RFC 2119&lt;/strong&gt; keywords (MUST, SHOULD, MAY) to establish a hierarchy of rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;MUST NOT store passwords in plaintext&lt;/code&gt; — a hard stop for the generator, regardless of language.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;SHOULD use async/await for I/O operations&lt;/code&gt; — architectural guidance, not a mandate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These keywords explicitly restrict the model's "creativity" in areas where consistency is critical.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. ✅ Acceptance Criteria: The Ground Truth
&lt;/h3&gt;

&lt;p&gt;Acceptance criteria are testable outcomes. If a behavior cannot be verified by an acceptance criterion, it isn't fully specified — it's hoped for. These criteria are the primary reference the &lt;strong&gt;Auditor&lt;/strong&gt; uses to validate generated code (more on that in Part 3).&lt;/p&gt;




&lt;h2&gt;
  
  
  Constraints vs. Implementation Hints
&lt;/h2&gt;

&lt;p&gt;One of the most powerful distinctions in ISL is between a mandatory &lt;strong&gt;Constraint&lt;/strong&gt; (🚨) and a non-binding &lt;strong&gt;Implementation Hint&lt;/strong&gt; (💡).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Constraint (🚨)&lt;/strong&gt; — if violated, the system is broken or insecure.&lt;br&gt;
&lt;em&gt;Example: "Passwords MUST be hashed before storage."&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hint (💡)&lt;/strong&gt; — a suggestion the LLM can ignore if it finds a more idiomatic approach that still satisfies the contract.&lt;br&gt;
&lt;em&gt;Example: "Consider using bcrypt for hashing."&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This distinction is what gives ISL the "senior developer" quality. If the LLM decides that Argon2 is a better fit for the target environment, it can use it — as long as the mandatory constraint (hashing) is satisfied. We are constraining the &lt;strong&gt;outcome&lt;/strong&gt;, not micro-managing the &lt;strong&gt;implementation&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Role Separation: Preventing Logic Leaks
&lt;/h2&gt;

&lt;p&gt;The most common source of technical debt in AI-assisted development is "logic leaking" — business rules buried in UI components, database details polluting service layers.&lt;/p&gt;

&lt;p&gt;ISL enforces separation of concerns through &lt;strong&gt;Roles&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role: Domain&lt;/strong&gt; — pure data structures and enums. No logic allowed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role: Business Logic&lt;/strong&gt; — pure state management and calculations. No UI or DB knowledge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Role: Presentation&lt;/strong&gt; — maps user input to logic triggers and renders state. Nothing else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By declaring a Role at the top of each spec file, we provide the LLM with a restricted mental model. A Presentation component is structurally prevented from making database calls because its grammar doesn't allow it. Architectural drift is eliminated before a single line of code is generated.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Boundary Rule (Rule 4): Intent, Not Implementation
&lt;/h2&gt;

&lt;p&gt;The most important principle of ISL is &lt;strong&gt;Rule 4: Intent, not Implementation&lt;/strong&gt;. When describing a flow, avoid low-level control flow and syntax entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;❌ Invalid — this is pseudocode, not a spec:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;FOR &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&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="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&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="nx"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="o"&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 locks the LLM into a specific implementation. It can't generate idiomatic Kotlin, Python, or Go — it just transcribes your pseudocode.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ Valid — this is intent:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gs"&gt;**Flow**&lt;/span&gt;:
&lt;span class="p"&gt;
1.&lt;/span&gt; Count all active items in the list

🚨 Constraint:
&lt;span class="p"&gt;
-&lt;/span&gt; MUST include only items where status = active
&lt;span class="p"&gt;-&lt;/span&gt; MUST NOT modify the original list

✅ Acceptance Criteria:
&lt;span class="p"&gt;
-&lt;/span&gt; Returns correct count for a list with mixed active/inactive items
&lt;span class="p"&gt;-&lt;/span&gt; Returns 0 for an empty list
&lt;span class="p"&gt;-&lt;/span&gt; Returns 0 when no items are active
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same logic. Zero implementation details. The LLM generates idiomatic code in any target language — and you can verify it against the acceptance criteria automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting It Together: A Real ISL Component
&lt;/h2&gt;

&lt;p&gt;Here's what all three pillars look like in a single, complete spec:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Component: UserAuthService&lt;/span&gt;

&lt;span class="gu"&gt;### Role: Business Logic&lt;/span&gt;

&lt;span class="gu"&gt;### ⚡ Capabilities&lt;/span&gt;

&lt;span class="gu"&gt;#### authenticateUser&lt;/span&gt;

&lt;span class="gs"&gt;**Contract**&lt;/span&gt;: Authenticate user credentials and return a session token

&lt;span class="gs"&gt;**Trigger**&lt;/span&gt;: Called by LoginForm on submit

&lt;span class="gs"&gt;**Flow**&lt;/span&gt;:
&lt;span class="p"&gt;
1.&lt;/span&gt; Validate credential format
&lt;span class="p"&gt;2.&lt;/span&gt; Verify credentials against stored record
&lt;span class="p"&gt;3.&lt;/span&gt; IF valid → generate session token
   IF invalid → return structured error

&lt;span class="gs"&gt;**💡 Implementation Hint**&lt;/span&gt;:
Consider bcrypt (cost factor 12) for password verification

&lt;span class="gs"&gt;**🚨 Constraints**&lt;/span&gt;:
&lt;span class="p"&gt;
-&lt;/span&gt; Passwords MUST NOT be compared in plaintext
&lt;span class="p"&gt;-&lt;/span&gt; Tokens MUST expire after 24 hours
&lt;span class="p"&gt;-&lt;/span&gt; MUST NOT log passwords in any form
&lt;span class="p"&gt;-&lt;/span&gt; Response time MUST be &amp;lt; 200ms (p95)

&lt;span class="gs"&gt;**✅ Acceptance Criteria**&lt;/span&gt;:
&lt;span class="p"&gt;
-&lt;/span&gt; [ ] Valid credentials return a token
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Invalid credentials return an authentication error
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Expired token returns 401, not 403

&lt;span class="gs"&gt;**🧪 Test Scenarios**&lt;/span&gt;:
&lt;span class="p"&gt;
1.&lt;/span&gt; &lt;span class="gs"&gt;**Valid Login**&lt;/span&gt;: {email: "user@test.com", password: "Valid123!"} → token returned
&lt;span class="p"&gt;2.&lt;/span&gt; &lt;span class="gs"&gt;**Wrong Password**&lt;/span&gt;: {email: "user@test.com", password: "wrong"} → authentication error
&lt;span class="p"&gt;3.&lt;/span&gt; &lt;span class="gs"&gt;**Locked Account**&lt;/span&gt;: 5 failed attempts → {error: "Account locked", code: 423}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what's not here: no JWT library choice, no bcrypt rounds hardcoded in the flow, no database query structure. The LLM decides the how. The spec owns the what.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: This article is a summary. For the full, formal documentation, visit the &lt;a href="https://github.com/fra00/isl-specification/blob/main/specs/Intent%20Specification%20Language%20(ISL).md" rel="noopener noreferrer"&gt;Complete ISL Specification&lt;/a&gt;.&lt;br&gt;
Notably, the ISL specification itself can be used as a &lt;strong&gt;tool-as-prompt&lt;/strong&gt; or &lt;strong&gt;skill&lt;/strong&gt; for other LLMs, providing them with the necessary framework to reason about software behavior with high precision and consistency.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;In Part 3, we go inside the engine that transforms this spec into production code — Builder, Compiler, cryptographic signatures, and the Auditor that verifies the result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://dev.to/francesco_marconi_282058b/inside-the-machine-the-isl-build-pipeline-3epp"&gt;Part 3: The Tooling Engine →&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>codequality</category>
      <category>llm</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Part 1 of 3 — Engineering Intent Series - Stop Prompting, Start Compiling: The Path to Predictable AI-Generated Code</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Wed, 01 Apr 2026 01:07:49 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/stop-prompting-start-compiling-the-path-to-predictable-ai-generated-code-c83</link>
      <guid>https://forem.com/francesco_marconi_282058b/stop-prompting-start-compiling-the-path-to-predictable-ai-generated-code-c83</guid>
      <description>&lt;p&gt;If you use LLMs to generate code, you are likely dealing with a "Slot Machine" workflow. You pull the lever with a prompt, get a great result, and then — two days later, on a different model, or with a different colleague — the same request produces something completely different.&lt;/p&gt;

&lt;p&gt;Different patterns, different variable names, different bugs. In software engineering, this inconsistency has a name: &lt;strong&gt;The Ambiguity Tax&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Root Cause: Conflating Intent with Implementation
&lt;/h2&gt;

&lt;p&gt;The problem isn't that the AI is hallucinating. The problem is that natural language is inherently ambiguous.&lt;/p&gt;

&lt;p&gt;Take this common request: &lt;em&gt;"Implement a user profile page with validation."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;To a human — or an AI — this leaves a dozen critical questions unanswered:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is validation client-side, server-side, or both?&lt;/li&gt;
&lt;li&gt;Does "profile" include avatar uploads or just text fields?&lt;/li&gt;
&lt;li&gt;What happens to the UI while the save is in progress?&lt;/li&gt;
&lt;li&gt;Is state managed locally or via a global store?&lt;/li&gt;
&lt;li&gt;What does a validation error look like — inline, toast, modal?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we leave these decisions to the LLM, we aren't engineering. We're gambling.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prompting is Not Methodology
&lt;/h2&gt;

&lt;p&gt;The industry is obsessed with "Prompt Engineering." But let's be honest: adding &lt;em&gt;"you are a world-class developer"&lt;/em&gt; to your request is a superstition, not a methodology.&lt;/p&gt;

&lt;p&gt;If your build process depends on the mood of a probabilistic model, you haven't built a pipeline. &lt;strong&gt;You've built a slot machine.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The root cause is that we tell the AI &lt;em&gt;how&lt;/em&gt; to do things — through examples, tone, role-playing — instead of formally defining &lt;em&gt;what&lt;/em&gt; must happen. We're negotiating with a language model when we should be compiling a specification.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: A Real Compiler for Intent
&lt;/h2&gt;

&lt;p&gt;This is where &lt;strong&gt;ISL (Intent Specification Language)&lt;/strong&gt; comes in — and it's important to say upfront: &lt;strong&gt;ISL is not a better prompt. It's a build system.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's what actually happens under the hood:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. You write a formal spec&lt;/strong&gt;, not a prompt. Each component gets its own &lt;code&gt;.isl.md&lt;/code&gt; file that defines behavior, constraints, and acceptance criteria — not implementation details.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The Builder resolves your entire project graph.&lt;/strong&gt; It scans all your spec files, identifies dependencies, and performs a &lt;strong&gt;topological sort&lt;/strong&gt;. Instead of giving "the whole project" to the AI hoping it understands, the Builder provides exactly and only what is needed for that specific piece, in the correct order. It’s &lt;strong&gt;context surgery&lt;/strong&gt;, not a generic text dump.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The Compiler generates code — not guesses.&lt;/strong&gt; IIt passes each component's precisely scoped context to the LLM, which at this point is functioning as a compiler back-end: mapping a deterministic spec to idiomatic syntax in your target language. React, Vue, Python, Go — same spec, same behavior, different output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Code is a read-only artifact.&lt;/strong&gt; Every generated file is locked with a cryptographic signature. The code is no longer the developer's domain; it's a build artifact. If a dev modifies the code by hand, it breaks the build. This enforces a strict discipline: documentation (ISL) and code are always perfectly aligned. It’s the end of "undocumented legacy code."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. The Auditor verifies behavior, not just syntax.&lt;/strong&gt; It runs against the generated code and checks that state transitions match the spec — catching logical dead-ends like a loading flag that never resets before a human ever sees the code.&lt;/p&gt;




&lt;h2&gt;
  
  
  What a Spec Looks Like
&lt;/h2&gt;

&lt;p&gt;Here's the difference between what you give an LLM today and what you give ISL:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Today:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Implement user authentication with JWT.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;With ISL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;#### authenticateUser&lt;/span&gt;

&lt;span class="gs"&gt;**Contract**&lt;/span&gt;: Authenticate credentials and return a session token

🚨 Constraints:
&lt;span class="p"&gt;
-&lt;/span&gt; Passwords MUST NOT be stored or compared in plaintext
&lt;span class="p"&gt;-&lt;/span&gt; Tokens MUST expire after 24 hours
&lt;span class="p"&gt;-&lt;/span&gt; MUST NOT log passwords in any form
&lt;span class="p"&gt;-&lt;/span&gt; Response time MUST be &amp;lt; 200ms (p95)

✅ Acceptance Criteria:
&lt;span class="p"&gt;
-&lt;/span&gt; Valid credentials → token returned
&lt;span class="p"&gt;-&lt;/span&gt; Invalid credentials → authentication error
&lt;span class="p"&gt;-&lt;/span&gt; Expired token → 401, not 403
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LLM doesn't decide what "secure" means. You do. The LLM compiles it.&lt;/p&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;The next two articles go deep on how this works in practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/francesco_marconi_282058b/engineering-intent-the-anatomy-of-isl-1bio"&gt;Part 2: The IKEA Manual for Software&lt;/a&gt;&lt;/strong&gt; — The anatomy of an ISL spec: contracts, constraints, acceptance criteria, and why the distinction between a Constraint and an Implementation Hint changes everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/francesco_marconi_282058b/inside-the-machine-the-isl-build-pipeline-3epp"&gt;Part 3: The Tooling Engine&lt;/a&gt;&lt;/strong&gt; — Builder, Compiler, signatures, and Auditor in detail — with a real end-to-end example.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The spec is open source: &lt;a href="https://github.com/fra00/isl-specification" rel="noopener noreferrer"&gt;github.com/fra00/isl-specification&lt;/a&gt;&lt;/p&gt;




</description>
      <category>ai</category>
      <category>llm</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>From Web to Desktop: Building CodeForge Portable with WebView2</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Mon, 12 Jan 2026 20:07:53 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/from-web-to-desktop-building-codeforge-portable-with-webview2-47fk</link>
      <guid>https://forem.com/francesco_marconi_282058b/from-web-to-desktop-building-codeforge-portable-with-webview2-47fk</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;Built a 2MB desktop version of my web-based AI coding assistant using WPF + WebView2. Result: Native filesystem access, multi-language compilation (C#, C++, Arduino), and &amp;lt;1s startup time. No Electron bloat required.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: Browser Limitations
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;CodeForge&lt;/a&gt;, a web-based AI coding assistant that helps developers write and edit code. The web version works well for editing and AI-powered code generation, but it has a fundamental limitation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The core issue isn't storage or UI - it's execution.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;From a browser, I cannot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Call native executables&lt;/strong&gt; (dotnet CLI, cmake, arduino-cli)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access the real filesystem&lt;/strong&gt; (only virtualized storage)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Execute system processes&lt;/strong&gt; (compile and run programs)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I explored alternatives:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local API server&lt;/strong&gt;: Requires users to run a separate backend process&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chrome extensions&lt;/strong&gt;: Limited API access, still can't spawn arbitrary processes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WebAssembly toolchains&lt;/strong&gt;: Incomplete, massive bundle sizes (50+ MB just for compilers)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The reality&lt;/strong&gt;: To compile C# projects with &lt;code&gt;dotnet build&lt;/code&gt;, C++ with &lt;code&gt;cmake&lt;/code&gt;, or upload Arduino sketches with &lt;code&gt;arduino-cli&lt;/code&gt;, I needed &lt;strong&gt;native system access&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A desktop application wasn't optional - it was necessary.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: WebView2 + WPF
&lt;/h2&gt;

&lt;p&gt;Instead of rewriting the entire application, I took a hybrid approach:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep the web UI, add a native wrapper.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why WebView2, Not Electron?
&lt;/h3&gt;

&lt;p&gt;I considered Electron (the standard choice), but the numbers didn't make sense:&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;Electron&lt;/th&gt;
&lt;th&gt;WebView2&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Bundle size&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;150+ MB&lt;/td&gt;
&lt;td&gt;2-5 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Startup time&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;3-5 seconds&lt;/td&gt;
&lt;td&gt;&amp;lt;1 second&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Memory usage&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;200+ MB&lt;/td&gt;
&lt;td&gt;60-80 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Platform&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cross-platform&lt;/td&gt;
&lt;td&gt;Windows only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a Windows-focused tool, WebView2 is objectively superior:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Chromium engine&lt;/strong&gt; (same as Electron) but uses Windows' built-in WebView2 runtime&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;100% code reuse&lt;/strong&gt; - my React UI runs unchanged&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tiny footprint&lt;/strong&gt; - just WPF shell + business logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The trade-off? Windows-only. But for my target audience (developers with Windows dev machines), that's acceptable.&lt;/p&gt;




&lt;h2&gt;
  
  
  Implementation: The PostMessage Bridge
&lt;/h2&gt;

&lt;p&gt;The magic happens through WebView2's PostMessage API - a simple, bidirectional communication channel between JavaScript and C#.&lt;/p&gt;

&lt;h3&gt;
  
  
  JavaScript → C# (Sending Commands)
&lt;/h3&gt;

&lt;p&gt;From the web UI, sending a compilation request:&lt;/p&gt;

&lt;p&gt;javascript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// React component&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;compileProject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;projectFiles&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;environment&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;zip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;createZipFromFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;projectFiles&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;base64Payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;btoa&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;build&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;csharp&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// or 'cpp', 'arduino', 'esp32'&lt;/span&gt;
    &lt;span class="na"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;base64Payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;arduinoConfig&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;environment&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;arduino&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;board&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;arduino:avr:uno&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;port&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;COM3&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;chrome&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;webview&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;postMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&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;h3&gt;
  
  
  C# → JavaScript (Receiving Results)
&lt;/h3&gt;

&lt;p&gt;In the WPF application, handling the message:&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// MainWindow.xaml.cs&lt;/span&gt;
&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;CoreWebView2_WebMessageReceived&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
    &lt;span class="n"&gt;CoreWebView2WebMessageReceivedEventArgs&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;jsonData&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WebMessageAsJson&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JsonConvert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DeserializeObject&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;WebMessagePayload&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;jsonData&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;payload&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;ProjectProcessor&lt;/span&gt; &lt;span class="n"&gt;processor&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;result&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;processor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ProcessPayload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Send result back to JavaScript&lt;/span&gt;
        &lt;span class="nf"&gt;SendToJavaScript&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; 
            &lt;span class="n"&gt;success&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;output&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="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;SendToJavaScript&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;JsonConvert&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;SerializeObject&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;webView&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CoreWebView2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;PostWebMessageAsJson&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&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;&lt;strong&gt;That's it.&lt;/strong&gt; No complex IPC, no gRPC, no WebSockets. Just JSON over PostMessage.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Payload Structure
&lt;/h3&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WebMessagePayload&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;JsonPropertyName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Action&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// "build", "run", "build_and_run"&lt;/span&gt;

    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;JsonPropertyName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"environment"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// "csharp", "cpp", "arduino"&lt;/span&gt;

    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;JsonPropertyName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"payload"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Payload&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// Base64-encoded ZIP&lt;/span&gt;

    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;JsonPropertyName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"arduinoConfig"&lt;/span&gt;&lt;span class="p"&gt;)]&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;ArduinoConfig&lt;/span&gt; &lt;span class="n"&gt;ArduinoConfig&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// Optional&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Decode Base64 → byte array&lt;/li&gt;
&lt;li&gt;Extract ZIP to temporary directory&lt;/li&gt;
&lt;li&gt;Invoke appropriate compiler&lt;/li&gt;
&lt;li&gt;Return output&lt;/li&gt;
&lt;li&gt;Clean up temp directory&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1p83x2lofi8500cfeyo.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp1p83x2lofi8500cfeyo.jpeg" alt=" " width="800" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture: Strategy Pattern for Multi-Environment Support
&lt;/h2&gt;

&lt;p&gt;Supporting multiple compilation environments (C#, C++, Arduino, ESP32) could have been a mess of if/else blocks. Instead, I used the &lt;strong&gt;Strategy Pattern&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Interface
&lt;/h3&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;IProjectBuilder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;projectPath&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;Every environment implements this contract, encapsulating its specific compilation logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example: Arduino Builder
&lt;/h3&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ArduinoProjectBuilder&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;IProjectBuilder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="n"&gt;ArduinoConfig&lt;/span&gt; &lt;span class="n"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="nf"&gt;ArduinoProjectBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ArduinoConfig&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;_config&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;sketchDir&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;FindSketchDirectory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;$"compile --fqbn &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Board&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; \"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sketchDir&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;\""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ShellExecutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ExecuteCommandAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;"arduino-cli"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;projectPath&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;sketchDir&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;FindSketchDirectory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="s"&gt;$"upload -p \"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Port&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;\" --fqbn &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Board&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt; \"&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sketchDir&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&gt;\""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="c1"&gt;// Execute in visible shell so user sees upload progress&lt;/span&gt;
        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ShellExecutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ExecuteVisibleCommandAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;"arduino-cli"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
            &lt;span class="n"&gt;projectPath&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;h3&gt;
  
  
  The Factory
&lt;/h3&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ProjectBuilderFactory&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;IProjectBuilder&lt;/span&gt; &lt;span class="nf"&gt;GetBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ArduinoConfig&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;null&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;environment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ToLowerInvariant&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;switch&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="s"&gt;"csharp"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;CSharpProjectBuilder&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="s"&gt;"cpp"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;CppProjectBuilder&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
            &lt;span class="s"&gt;"arduino"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArduinoProjectBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="s"&gt;"esp32"&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;ArduinoProjectBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// Same builder, different config&lt;/span&gt;
            &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="p"&gt;=&amp;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="nf"&gt;ArgumentException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;$"Unsupported environment: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s"&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;h3&gt;
  
  
  Why Strategy Over If/Else?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Bad approach&lt;/strong&gt; (what I avoided):&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;ProcessPayload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;WebMessagePayload&lt;/span&gt; &lt;span class="n"&gt;payload&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;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"csharp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// 50 lines of C# compilation logic&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&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;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"cpp"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// 60 lines of C++ compilation logic&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;else&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;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"arduino"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// 70 lines of Arduino logic&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c1"&gt;// This gets unmaintainable fast&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Good approach&lt;/strong&gt; (Strategy pattern):&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="n"&gt;Task&lt;/span&gt; &lt;span class="nf"&gt;ProcessPayload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;WebMessagePayload&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;builder&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ProjectBuilderFactory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetBuilder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Environment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
        &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ArduinoConfig&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;buildOutput&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;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Build&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;projectPath&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;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Action&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"run"&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;builder&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;projectPath&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;Adding Python support? Create &lt;code&gt;PythonProjectBuilder&lt;/code&gt;, add one line to the factory. &lt;strong&gt;Zero changes&lt;/strong&gt; to existing code.&lt;/p&gt;




&lt;h2&gt;
  
  
  Real-World Impact
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Before (Web Version)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;❌ Compile/run: Impossible (browser sandbox)&lt;/li&gt;
&lt;li&gt;❌ Arduino upload: Impossible&lt;/li&gt;
&lt;li&gt;❌ Filesystem: IndexedDB only&lt;/li&gt;
&lt;li&gt;✅ Install: 0 MB (hosted)&lt;/li&gt;
&lt;li&gt;✅ Portability: Any browser&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  After (Desktop Version)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;✅ Compile/run: Native (dotnet, cmake, arduino-cli)&lt;/li&gt;
&lt;li&gt;✅ Arduino upload: Working&lt;/li&gt;
&lt;li&gt;✅ Filesystem: Native OS access&lt;/li&gt;
&lt;li&gt;✅ Install: 2-5 MB&lt;/li&gt;
&lt;li&gt;❌ Portability: Windows only&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Performance Benchmarks
&lt;/h3&gt;

&lt;p&gt;Tested on: Windows 11, Ryzen 5 5600X, 16GB RAM&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;Electron (estimate)&lt;/th&gt;
&lt;th&gt;CodeForge Portable&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cold startup&lt;/td&gt;
&lt;td&gt;3-5s&lt;/td&gt;
&lt;td&gt;0.8s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory (idle)&lt;/td&gt;
&lt;td&gt;200+ MB&lt;/td&gt;
&lt;td&gt;65 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory (compiling)&lt;/td&gt;
&lt;td&gt;250+ MB&lt;/td&gt;
&lt;td&gt;120 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Installer size&lt;/td&gt;
&lt;td&gt;150+ MB&lt;/td&gt;
&lt;td&gt;4.2 MB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Dual-Mode Execution
&lt;/h3&gt;

&lt;p&gt;One subtle but important feature: &lt;strong&gt;dual-mode shell execution&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build phase&lt;/strong&gt; (headless):&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Capture output, don't show window&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ShellExecutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ExecuteCommandAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"dotnet"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"build"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;projectPath&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run/Upload phase&lt;/strong&gt; (visible):&lt;/p&gt;

&lt;p&gt;csharp&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Show terminal window so user sees progress&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;ShellExecutor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ExecuteVisibleCommandAsync&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"arduino-cli"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"upload ..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;projectPath&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 critical for Arduino uploads - users need to see the upload progress and any connection errors in real-time.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Meta Moment
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Here’s something interesting: the entire C# backend was generated using CodeForge itself.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I used the web version powered by &lt;strong&gt;Gemini 2.5 Flash&lt;/strong&gt;, provided explicit architectural constraints (Strategy pattern, multi-environment support, async execution, resource cleanup), and CodeForge produced &lt;strong&gt;all 7 C# files in 28 structured operations&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This wasn’t scaffolding.&lt;br&gt;&lt;br&gt;
This wasn’t boilerplate.&lt;/p&gt;

&lt;p&gt;It resulted in a &lt;strong&gt;production-ready WPF backend&lt;/strong&gt; with clear separation of concerns, design patterns, error handling, and deterministic runtime behavior.&lt;/p&gt;

&lt;p&gt;The LLM was used strictly at &lt;strong&gt;design-time&lt;/strong&gt; to generate the code. Once compiled, the application runs as a &lt;strong&gt;fully deterministic system with no AI involved at runtime&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This wasn’t accidental — CodeForge uses a &lt;strong&gt;custom DSL embedded in natural language&lt;/strong&gt; to guide the LLM through complex, multi-step engineering tasks.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The DSL and orchestration model deserve a dedicated article of their own.)&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. WebView2 Is Production-Ready
&lt;/h3&gt;

&lt;p&gt;I was initially hesitant about WebView2 (relatively new, Windows-only). After building this, I'm convinced: &lt;strong&gt;for Windows-focused tools, WebView2 &amp;gt; Electron&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The performance difference is real, not theoretical. Sub-second startup and 60MB memory footprint vs Electron's bloat is night and day.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. PostMessage Is Simple and Robust
&lt;/h3&gt;

&lt;p&gt;I expected to need complex IPC mechanisms. PostMessage proved sufficient:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JSON serialization handles 99% of use cases&lt;/li&gt;
&lt;li&gt;Async by default (no blocking)&lt;/li&gt;
&lt;li&gt;Error handling is straightforward&lt;/li&gt;
&lt;li&gt;Debugging is easy (just log the JSON)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Strategy Pattern Scales
&lt;/h3&gt;

&lt;p&gt;As I added C++, then Arduino, then ESP32 support, the architecture never creaked. Each new environment was:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create new &lt;code&gt;XxxProjectBuilder&lt;/code&gt; class&lt;/li&gt;
&lt;li&gt;Add one line to factory&lt;/li&gt;
&lt;li&gt;Done&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No refactoring, no touching existing code. &lt;strong&gt;This is what good architecture feels like.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. You Don't Always Need Electron
&lt;/h3&gt;

&lt;p&gt;The web development community defaults to Electron for "desktop apps from web code". But if you're targeting a single platform, evaluate native options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Windows&lt;/strong&gt;: WebView2 (this project)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS&lt;/strong&gt;: WKWebView (Swift)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linux&lt;/strong&gt;: WebKitGTK&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The performance gains are worth it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;CodeForge Portable demonstrates that you can have both portability (web version) and power (desktop version) without maintaining two codebases.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key takeaways&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebView2 enables 100% code reuse with native capabilities&lt;/li&gt;
&lt;li&gt;PostMessage is sufficient for most UI ↔ Backend communication&lt;/li&gt;
&lt;li&gt;Strategy pattern makes multi-environment support maintainable&lt;/li&gt;
&lt;li&gt;A lightweight native host unlocks &lt;strong&gt;real hardware integration&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Native filesystem access&lt;/li&gt;
&lt;li&gt;Tool execution (dotnet, cmake, arduino-cli)&lt;/li&gt;
&lt;li&gt;Serial port access (Arduino / ESP32 monitoring)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Try it yourself&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web version&lt;/strong&gt;: &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;https://llm-codeforge.netlify.app/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Desktop (this article)&lt;/strong&gt;: &lt;a href="https://github.com/fra00/CodeForge-Ai-Portable" rel="noopener noreferrer"&gt;GitHub - fra00/CodeForge-Ai-Portable&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The desktop version adds native compilation for C#, C++, and Arduino/ESP32 boards. If you're building developer tools, consider the hybrid approach - it might be the best of both worlds.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Questions? Feedback?&lt;/strong&gt; Drop a comment below or open an issue on GitHub. I'm particularly interested in hearing from developers who've tried similar architectures.&lt;/p&gt;

&lt;p&gt;Related articles:&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga"&gt;Building an AI-Powered Code Editor&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi"&gt;Building an AI-Powered Code Editor: (part 2)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1"&gt;Building an AI-Powered Code Editor: Browser Test Runner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webview2</category>
      <category>architecture</category>
      <category>wpf</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building an AI-Powered Code Editor: Browser Test Runner component</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Tue, 06 Jan 2026 17:16:18 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1</link>
      <guid>https://forem.com/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1</guid>
      <description>&lt;h1&gt;
  
  
  Browser Test Runner: Run Unit Tests Directly in the Browser
&lt;/h1&gt;

&lt;p&gt;I've just released &lt;strong&gt;Browser Test Runner&lt;/strong&gt;, an open-source React component suite that lets you write, compile, and run unit tests directly in the browser—no complex server-side build steps required.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;Try it Live&lt;/strong&gt;: &lt;a href="https://browser-test-runner.netlify.app/" rel="noopener noreferrer"&gt;https://browser-test-runner.netlify.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💡 &lt;strong&gt;The Idea&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project was born from a real need: I developed it as part of &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;LLM CodeForge&lt;/a&gt;, an agentic code editor that generates tests directly in the browser.&lt;br&gt;
The goal was to create a "Zero Config" testing environment. I wanted something that could be seamlessly integrated directly into a web component, while maintaining the familiar syntax of Vitest, because in my case the Vitest syntax is simple to use for an LLM.&lt;/p&gt;

&lt;p&gt;🛠 &lt;strong&gt;Under the Hood (Tech Stack)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project isn't just a graphical wrapper—it's a real client-side execution engine:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Virtual File System&lt;/strong&gt;: Manages &lt;code&gt;.jsx&lt;/code&gt; and &lt;code&gt;.test.jsx&lt;/code&gt; files in memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;On-the-fly Transpilation&lt;/strong&gt;: Uses Babel Standalone and Acorn to parse and transform JSX code and ES6 imports in real-time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sandboxing&lt;/strong&gt;: Executes tests in an isolated iframe to ensure security and clean global scope.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dynamic Imports&lt;/strong&gt;: Loads React and Testing Library dynamically via CDN (esm.sh), keeping the runner lightweight.&lt;/p&gt;

&lt;p&gt;🎯 &lt;strong&gt;Use Cases&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Interactive Documentation&lt;/strong&gt;: Show your users not just how to render a component, but how to test it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Education&lt;/strong&gt;: Perfect for teaching TDD (Test Driven Development) without the overhead of npm installation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rapid Prototyping&lt;/strong&gt;: Write, test, and iterate in seconds.&lt;/p&gt;

&lt;p&gt;💻 &lt;strong&gt;Integration Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's easily integrable into any existing React app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;TestComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./testing/TestComponent&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/Button.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;isFolder&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/Button.test.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;isFolder&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;TestComponent&lt;/span&gt; 
  &lt;span class="na"&gt;files&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;files&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
  &lt;span class="na"&gt;testFilePaths&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/Button.test.jsx&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; 
&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project is open source! I'd be happy to receive feedback, stars ⭐, or pull requests.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;GitHub Repo&lt;/strong&gt;: &lt;a href="https://github.com/fra00/browser-test-runner" rel="noopener noreferrer"&gt;https://github.com/fra00/browser-test-runner&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Optional closing paragraphs you might want to add:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;What's Next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm planning to add support for more testing frameworks, improve error reporting, and enhance the code editor experience. If you have suggestions or feature requests, feel free to open an issue on GitHub!&lt;/p&gt;

&lt;p&gt;🤝 &lt;strong&gt;Contributing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Contributions are welcome! Whether it's bug fixes, new features, or documentation improvements, check out the repository and join the project.&lt;/p&gt;

&lt;p&gt;Related articles:&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga"&gt;Building an AI-Powered Code Editor&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi"&gt;Building an AI-Powered Code Editor: (part 2)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1"&gt;Building an AI-Powered Code Editor: Browser Test Runner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>showdev</category>
      <category>testing</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Building an AI-Powered Code Editor: (part 2) LLM like interpreter</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Mon, 29 Dec 2025 22:42:51 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi</link>
      <guid>https://forem.com/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi</guid>
      <description>&lt;h1&gt;
  
  
  It’s Not a Prompt. It’s a Procedural DSL in Natural Language
&lt;/h1&gt;

&lt;p&gt;While building &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;LLM CodeForge&lt;/a&gt;, an agentic editor that allows LLMs to read, modify, and test code autonomously(for more info read &lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga"&gt;LLM Codeforge Ai first editor&lt;/a&gt; ... sorry tested only on Gemini), after 5000 tokens of instructions, I realized something:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I wasn't writing a prompt. I was building a Domain-Specific Language embedded in natural language.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article analyzes how and why this distinction is fundamental—and what you can learn for your own agentic systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  The LLM Doesn't Decide, It Executes
&lt;/h2&gt;

&lt;p&gt;Initially, I thought I was "instructing" an LLM on how to behave. But watching the system work, I realized I was doing something different:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I was forcing the model to impersonate an interpreter.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The model in CodeForge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does not decide &lt;em&gt;what&lt;/em&gt; to do&lt;/li&gt;
&lt;li&gt;Decides only &lt;em&gt;which branch of the protocol&lt;/em&gt; to follow&lt;/li&gt;
&lt;li&gt;Does not solve problems creatively&lt;/li&gt;
&lt;li&gt;Executes a procedure described in natural language&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is very close to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A bytecode interpreter&lt;/li&gt;
&lt;li&gt;A text-driven Finite State Machine&lt;/li&gt;
&lt;li&gt;A planner with closed actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And it works &lt;em&gt;because I accepted&lt;/em&gt; that the LLM is fundamentally unreliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Anatomy of an Embedded DSL
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Control Flow: Decision Protocol
&lt;/h3&gt;

&lt;p&gt;Here is what the DSL's "control flow" looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Every request follows 4 steps: 
[UNDERSTAND] → [GATHER] → [EXECUTE] → [RESPOND]

&lt;span class="gu"&gt;### Step 1: UNDERSTAND&lt;/span&gt;
Classify request type:

| Type         | Keywords              | Next Step           |
|--------------|-----------------------|---------------------|
| Explanation  | "what is", "explain"  | [RESPOND] text      |
| Modification | "add", "change"       | [GATHER] → [EXECUTE]|
| Analysis     | "analyze", "show"     | [GATHER] → [RESPOND]|
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not Chain-of-Thought in the classic sense. It is &lt;strong&gt;deterministic task routing&lt;/strong&gt;—a decision table mapping input → workflow.&lt;/p&gt;

&lt;p&gt;The model doesn't "think", &lt;strong&gt;it executes a conditional jump&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Invariants: Read-Before-Write Policy
&lt;/h3&gt;

&lt;p&gt;The DSL defines invariants that must be maintained:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;🚨 CRITICAL RULE: You CANNOT use &lt;span class="sb"&gt;`update_file`&lt;/span&gt; 
on a file you haven't read in this conversation.

Self-check before ANY update_file:
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Did I receive the content from system?
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Do I know exact current state?
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Am I modifying based on actual code?

If ANY answer is NO → OUTPUT read_file ACTION, STOP.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is an &lt;strong&gt;attempt to define pre-conditions&lt;/strong&gt; in natural language. It’s like writing:&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;def&lt;/span&gt; &lt;span class="nf"&gt;update_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;content&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;path&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;conversation_state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_files&lt;/span&gt;
    &lt;span class="c1"&gt;# ... actual update
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But without a type system or automatic runtime enforcement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important note&lt;/strong&gt;: This rule &lt;em&gt;significantly reduces&lt;/em&gt; the probability of the LLM modifying a file without having read its content first, but it does not guarantee 100% enforcement. It is a constraint expressed in natural language, therefore subject to the probabilistic interpretation of the model. In tests, I observed high stability (~85-90%), but server-side validation remains fundamental for critical cases.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. State Management: Injection + Hard Next Action
&lt;/h3&gt;

&lt;p&gt;The most effective technique I implemented is &lt;strong&gt;dynamically regenerating the prompt&lt;/strong&gt; to force the LLM to follow a multi-step plan.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concrete scenario&lt;/strong&gt;: The user asks "Add authentication to the project".&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: The LLM analyzes and generates a plan:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"plan"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"I will modify these files in order:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"files_to_modify"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Auth.js"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Login.jsx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"App.jsx"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt;: The LLM starts with the first file (Auth.js) and completes it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3 - HERE IS THE TRICK&lt;/strong&gt;: Instead of asking the LLM "remember the plan, do the next file", I &lt;strong&gt;completely regenerate the prompt&lt;/strong&gt; adding this section:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### ⚠️ MULTI-FILE TASK IN PROGRESS&lt;/span&gt;

You completed: Auth.js
Remaining files: Login.jsx, App.jsx

&lt;span class="gu"&gt;### 🚨 REQUIRED ACTION&lt;/span&gt;
Your next output MUST be:
{"action":"continue_multi_file","next_file":{"path":"Login.jsx"}}

Do NOT do anything else. Do NOT deviate from the plan.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: The LLM doesn't have to "remember" anything. It cannot "forget" the plan. It cannot decide to do something else. The prompt itself contains the only possible action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it is powerful&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The state (which files I've done, which are missing) lives in the JavaScript code, not in the LLM's "memory"&lt;/li&gt;
&lt;li&gt;At every step, I regenerate the prompt with the updated state&lt;/li&gt;
&lt;li&gt;The LLM always sees "you are here, do this" — zero ambiguity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;In practice&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In the code&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildPrompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;multiFileState&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="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;BASE_PROMPT&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="nx"&gt;multiFileState&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;`
    ### TASK IN PROGRESS
    Completed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;multiFileState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;completed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;
    Next: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;multiFileState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;
    Your ONLY valid action: continue_multi_file with &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;multiFileState&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;next&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="nx"&gt;prompt&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 &lt;strong&gt;state injection&lt;/strong&gt;: external state (JavaScript) completely controls what the LLM can do at the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Simulated Type System: Structured Output
&lt;/h3&gt;

&lt;p&gt;To handle different "types" (JSON + code + metadata), the DSL uses custom delimiters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;#[json-data]&lt;/span&gt;
{"action":"create_file","file":{"path":"App.jsx"}}
&lt;span class="gh"&gt;#[end-json-data]&lt;/span&gt;
&lt;span class="gh"&gt;#[file-message]&lt;/span&gt;
This file implements the main app component.
&lt;span class="gh"&gt;#[end-file-message]&lt;/span&gt;
&lt;span class="gh"&gt;#[content-file]&lt;/span&gt;
export default function App() {
  return &lt;span class="nt"&gt;&amp;lt;div&amp;gt;&lt;/span&gt;Hello World&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;;
}
&lt;span class="gh"&gt;#[end-content-file]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why not standard JSON or XML? Because the &lt;strong&gt;content&lt;/strong&gt; might contain &lt;code&gt;{}&lt;/code&gt; or &lt;code&gt;&amp;lt;&amp;gt;&lt;/code&gt; — it would require complex escaping.&lt;/p&gt;

&lt;p&gt;The delimiters &lt;code&gt;#[tag]...#[end-tag]&lt;/code&gt; are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Syntactically unique (no conflicts with internal code)&lt;/li&gt;
&lt;li&gt;Easy to parse (regex + split)&lt;/li&gt;
&lt;li&gt;Independent of the embedded language&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is like defining a &lt;strong&gt;context-free grammar&lt;/strong&gt; to separate semantic levels.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Error Handling: Anti-Pattern Documentation
&lt;/h3&gt;

&lt;p&gt;The DSL includes "error examples" to guide the parser (the model):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gs"&gt;**Common Errors:**&lt;/span&gt;

❌ {"action":"start_multi_file","plan":{},"first_file":{...}}
✅ {"action":"start_multi_file","plan":{},"first_file":{...}}}

❌ #[json-data]{...}#[file-message]...
✅ #[json-data]{...}#[end-json-data]#[file-message]...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is &lt;strong&gt;inline error-correction training&lt;/strong&gt; — I am teaching the model the common failure modes. It’s like unit tests embedded in the language documentation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Price: Structural Tensions
&lt;/h2&gt;

&lt;p&gt;Building a DSL in natural language isn't free. Here are the trade-offs I accepted:&lt;/p&gt;

&lt;h3&gt;
  
  
  Tension #1: No Real Type System
&lt;/h3&gt;

&lt;p&gt;I am creating a procedural DSL, but:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ It has no verifiable types&lt;/li&gt;
&lt;li&gt;❌ It has no automatic syntactic validation&lt;/li&gt;
&lt;li&gt;❌ It has no AST for transformations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Huge validation checklist (8+ points)&lt;/li&gt;
&lt;li&gt;✅ Semantic redundancy (same rules, 3+ formulations)&lt;/li&gt;
&lt;li&gt;✅ Extensive anti-pattern documentation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is &lt;strong&gt;inevitable&lt;/strong&gt; when the parser is a probabilistic LLM instead of a deterministic compiler.&lt;/p&gt;

&lt;p&gt;If I were to evolve CodeForge in the future, a true mini-DSL (JSON Schema + codegen) would reduce the prompt by &lt;strong&gt;30-40%&lt;/strong&gt;. But in the browser sandbox, this choice is justified.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tension #2: Meta-Validation Only Works as a Multiplier
&lt;/h3&gt;

&lt;p&gt;The pre-send checklist I implemented:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before EVERY response, verify:
| # | Check | Fix If Failed |
|---|-------|---------------|
| 1 | JSON valid | Correct structure |
| 2 | Tags complete | Add missing #[end-&lt;span class="err"&gt;*&lt;/span&gt;] |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Alone, it would have 40-60% reliability.&lt;/strong&gt; In my system, it probably has 80-90%.&lt;/p&gt;

&lt;p&gt;Why? Because it works as a &lt;strong&gt;stability multiplier&lt;/strong&gt; when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The model is already channeled (decision protocol)&lt;/li&gt;
&lt;li&gt;The format is rigid (custom delimiters)&lt;/li&gt;
&lt;li&gt;The next action is deterministic (state injection)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Meta-validation is not the main feature — it is the &lt;strong&gt;final safety net&lt;/strong&gt; in an already constrained system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tension #3: High Cognitive Cost
&lt;/h3&gt;

&lt;p&gt;5000 dense tokens with intersecting rules means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Works well with Claude 3.5, GPT-4&lt;/li&gt;
&lt;li&gt;❌ Smaller models will fail&lt;/li&gt;
&lt;li&gt;❌ Less aligned models will ignore sections&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am implicitly saying: &lt;strong&gt;this system requires "serious" models&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is an architectural constraint I accepted — like saying "this library requires Python 3.10+".&lt;/p&gt;

&lt;h2&gt;
  
  
  Techniques That Work: Contextual Re-Anchoring
&lt;/h2&gt;

&lt;p&gt;One thing I did (almost by instinct) is &lt;strong&gt;contextual re-anchoring&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Take the "read-before-write" rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It appears in the Decision Protocol (when planning)&lt;/li&gt;
&lt;li&gt;It appears in Available Actions (when executing)&lt;/li&gt;
&lt;li&gt;It appears in Pre-Send Validation (when verifying)&lt;/li&gt;
&lt;li&gt;It appears in Golden Rules (as a general principle)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is not random redundancy. It is &lt;strong&gt;strategic repetition in different contexts&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is &lt;em&gt;exactly&lt;/em&gt; how it is done in safety-critical systems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Same invariant&lt;/li&gt;
&lt;li&gt;Verified at multiple levels&lt;/li&gt;
&lt;li&gt;With specific phrasing for the context&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Replicable Patterns: How to Build an Agentic DSL
&lt;/h2&gt;

&lt;p&gt;If you want to build a similar system, here are the patterns I extracted:&lt;/p&gt;

&lt;h3&gt;
  
  
  Pattern #1: External State &amp;gt; Internal Memory
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// BAD: Relying on the model's "memory"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Remember that you have already read these files...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;// GOOD: Injecting explicit state&lt;/span&gt;
&lt;span class="nx"&gt;prompt&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="s2"&gt;`Files already read: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;readFiles&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;, &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pattern #2: Reduce Branching When Possible
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;// BAD: Giving open choices
"Decide which operation to perform"

// GOOD: Forcing the only legal move
"Your NEXT action MUST be: continue_multi_file"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Pattern #3: Decision Tables for Routing
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;| Input Pattern | Action | Next State |
|---------------|--------|------------|
| "add X"       | GATHER | EXECUTE    |
| "explain Y"   | RESPOND| END        |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of "think what to do", use "if X then Y".&lt;/p&gt;

&lt;h3&gt;
  
  
  Pattern #4: Custom Delimiters for Content Nesting
&lt;/h3&gt;

&lt;p&gt;When you have to embed arbitrary content:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Don't use JSON (escaping nightmare)&lt;/li&gt;
&lt;li&gt;Don't use XML (conflicts with HTML/JSX)&lt;/li&gt;
&lt;li&gt;Use unique tags: &lt;code&gt;#[content]...#[end-content]&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Pattern #5: Redundancy = Coverage, Not Noise
&lt;/h3&gt;

&lt;p&gt;Repeat critical rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In different formulations (semantic reinforcement)&lt;/li&gt;
&lt;li&gt;In different contexts (contextual re-anchoring)&lt;/li&gt;
&lt;li&gt;With different rationales (why, not just what)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I Learned: Engineering &amp;gt; Elegance
&lt;/h2&gt;

&lt;p&gt;After 5000 tokens and months of iterations, the most important lesson:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This prompt is not "beautiful". It is effective.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I stopped looking for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✗ The shortest possible prompt&lt;/li&gt;
&lt;li&gt;✗ The most elegant formulation&lt;/li&gt;
&lt;li&gt;✗ The most general abstraction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I started optimizing for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✓ Robustness in edge cases&lt;/li&gt;
&lt;li&gt;✓ Failure mode coverage&lt;/li&gt;
&lt;li&gt;✓ Debugging clarity when it fails&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Redundant? Yes.&lt;/li&gt;
&lt;li&gt;Verbose? Absolutely.&lt;/li&gt;
&lt;li&gt;Works? &lt;strong&gt;Consistently.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Future Directions: Where I Could Go
&lt;/h2&gt;

&lt;p&gt;If I were to evolve CodeForge 2.0, I would explore:&lt;/p&gt;

&lt;h3&gt;
  
  
  Two-Agent Architecture
&lt;/h3&gt;

&lt;p&gt;Instead of a single-agent with 5000 tokens:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Planner Agent&lt;/strong&gt; (2000 tokens): Decides strategy&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Executor Agent&lt;/strong&gt; (2000 tokens): Implements actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Separation of concerns&lt;/li&gt;
&lt;li&gt;Less context per agent&lt;/li&gt;
&lt;li&gt;Parallel execution possible&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusions: State-of-the-Art for Coding Agents
&lt;/h2&gt;

&lt;p&gt;Developing &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;LLM CodeForge&lt;/a&gt; taught me that building reliable agentic systems means:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accepting that LLMs are fundamentally unreliable, and designing around that fact.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The techniques that work:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;⭐⭐⭐⭐⭐ State injection + forced next action&lt;/li&gt;
&lt;li&gt;⭐⭐⭐⭐⭐ Decision tables for task routing&lt;/li&gt;
&lt;li&gt;⭐⭐⭐⭐ Custom delimiters for structured output&lt;/li&gt;
&lt;li&gt;⭐⭐⭐⭐ Contextual re-anchoring of invariants&lt;/li&gt;
&lt;li&gt;⭐⭐⭐ Meta-validation as a safety net&lt;/li&gt;
&lt;li&gt;⭐⭐ Visual hierarchy (useful but not critical)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The fundamental principle&lt;/strong&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Don't ask the LLM to "understand" — force it to "execute".&lt;br&gt;
Don't do prompt engineering — do &lt;strong&gt;protocol design in natural language&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When you build your next agentic system:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Treat it like a DSL, not a conversation&lt;/li&gt;
&lt;li&gt;External state must constrain possible actions&lt;/li&gt;
&lt;li&gt;Validate server or client side, always, without exceptions&lt;/li&gt;
&lt;li&gt;Redundancy can be a feature, not a bug&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;LLMs are powerful tools, but they are probabilistic parsers, not deterministic compilers. Design accordingly.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Try CodeForge&lt;/strong&gt;: &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;https://llm-codeforge.netlify.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is open source — if you want to see the full prompt and the validation system implementation, you can find everything in the repository.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions for the community&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have you ever built embedded DSLs in natural language?&lt;/li&gt;
&lt;li&gt;What is the cost of "cognitive overhead" in your prompts?&lt;/li&gt;
&lt;li&gt;Two-agent architecture vs single-agent: experiences?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Share in the comments — this is still largely unexplored territory.&lt;/p&gt;

&lt;p&gt;Related articles:&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga"&gt;Building an AI-Powered Code Editor&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi"&gt;Building an AI-Powered Code Editor: (part 2)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1"&gt;Building an AI-Powered Code Editor: Browser Test Runner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>webdev</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>Building an AI-Powered Code Editor: A Journey into Structured LLM Integration</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Thu, 11 Dec 2025 22:41:59 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga</link>
      <guid>https://forem.com/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga</guid>
      <description>&lt;p&gt;I've been working on an idea: creating an online editor that isn't just a chat window, but a true "pair programmer" integrated into the development environment. The goal is to facilitate development with a tool that understands project context, executes complex tasks, and most importantly, is reliable.&lt;/p&gt;

&lt;p&gt;You can try it here: &lt;a href="https://llm-codeforge.netlify.app/" rel="noopener noreferrer"&gt;llm-codeforge&lt;/a&gt; - Now Works only with gemini&lt;br&gt;&lt;br&gt;
Repository: &lt;a href="https://github.com/fra00/CodeForge-AI" rel="noopener noreferrer"&gt;CodeForge-AI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One of the main challenges I wanted to address is how to make AI interaction more structured and context-aware.&lt;/p&gt;

&lt;p&gt;Here are some of the concepts I based my project on:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Context is King: the Virtual File System (VFS)
&lt;/h2&gt;

&lt;p&gt;To make the AI "see" the project, the application manages an entire virtual file system in memory, persisted on IndexedDB. This allows the assistant to have a complete and up-to-date view of the folder structure and files - a fundamental prerequisite for any meaningful operation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxxgvv7d3xxb8wcp9tqy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpxxgvv7d3xxb8wcp9tqy.png" alt=" " width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A "Contract" with the AI: JSON Schema Validation
&lt;/h2&gt;

&lt;p&gt;Interaction with LLMs can be unpredictable. To mitigate this problem, I defined a very strict JSON schema that the AI must respect for each response. Every output is validated through AJV. If validation fails, the system sends automatic feedback to the AI, asking it to correct its response. This transforms the interaction from a hope into a contract, increasing reliability.&lt;/p&gt;

&lt;p&gt;Beyond this, I divided responses with a multi-part pattern that isolates various parts of the message, avoiding complex JSON parsing issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. A Framework for Structured Prompts (2WHAV "Light")
&lt;/h2&gt;

&lt;p&gt;To make creating complex prompts more efficient, I created a "light" version of the 2WHAV framework. This internal tool helps expand a simple user request into a detailed technical specification that the AI can follow. The idea is to provide the assistant with a clear action plan from the start, instead of a vague idea.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrdx5x3o87qvfqx77vvt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqrdx5x3o87qvfqx77vvt.png" alt=" " width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. An Action Loop for Complex Tasks
&lt;/h2&gt;

&lt;p&gt;The assistant doesn't just respond. It can execute a series of "tools" (like &lt;code&gt;list_files&lt;/code&gt;, &lt;code&gt;read_file&lt;/code&gt;) and actions (&lt;code&gt;create_file&lt;/code&gt;, &lt;code&gt;update_file&lt;/code&gt;). This happens within a loop that allows the AI to break down a complex problem into smaller steps, such as sequentially modifying multiple files to implement a new feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. User Experience at the Center
&lt;/h2&gt;

&lt;p&gt;Technology is fascinating, but it must be useful. Every error that appears in the live preview console is clickable. One click and the error is immediately copied into the AI's input, ready to be analyzed. A small detail that reduces friction and makes the debugging process smoother, while auto-correction is a work in progress.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6oiwg17b2k89pdyrwx1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg6oiwg17b2k89pdyrwx1.png" alt=" " width="800" height="309"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Building this application is a fascinating journey into software engineering applied to AI. The goal isn't to create a "magic box," but a tool robust and predictable enough to provide useful help and usable code.&lt;/p&gt;

&lt;p&gt;The road is still long and challenges abound, but as a POC, I think it's a good result.&lt;/p&gt;

&lt;p&gt;What do you think? What are the biggest challenges in integrating AI into our development workflows?&lt;/p&gt;

&lt;p&gt;Related articles:&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-a-journey-into-structured-llm-integration-3mga"&gt;Building an AI-Powered Code Editor&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/building-an-ai-powered-code-editor-part-2-llm-like-interpreter-4oi"&gt;Building an AI-Powered Code Editor: (part 2)&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/francesco_marconi_282058b/browser-test-runner-no-build-step-react-testing-5gn1"&gt;Building an AI-Powered Code Editor: Browser Test Runner&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>ai</category>
    </item>
    <item>
      <title>How the 2WHAV-Iterative Cycle Turns Uncertainty into Production-Ready Code</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Sun, 09 Nov 2025 01:38:11 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/how-the-2whav-iterative-cycle-turns-uncertainty-into-production-ready-code-1dk4</link>
      <guid>https://forem.com/francesco_marconi_282058b/how-the-2whav-iterative-cycle-turns-uncertainty-into-production-ready-code-1dk4</guid>
      <description>&lt;h4&gt;
  
  
  Stop "chatting" with your LLM.
&lt;/h4&gt;

&lt;p&gt;To achieve predictable results from a Large Language Model, it's necessary to stop communicating in prose and start providing &lt;strong&gt;executable specifications&lt;/strong&gt;. This concept is the foundation of the &lt;strong&gt;&lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV&lt;/a&gt;&lt;/strong&gt; framework, a structured way to transform a requirement into a "blueprint" that an LLM can execute, not just interpret.&lt;/p&gt;

&lt;p&gt;But even the most detailed blueprint cannot capture the complexity of the real world on the first try. The secret to moving from a "good attempt" to "robust code" is not a longer prompt. It's an &lt;strong&gt;engineered feedback process&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Test the Process Yourself&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Before analyzing the theory, here is a practical experiment to run on an advanced LLM. Copy and paste the following commands step-by-step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Load the framework context&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Ask the LLM (tested on Gemini) to load the rules of the iterative process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Load the README.md file from the URL: https://github.com/fra00/2WHAV-iterative
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2 (Optional): Test comprehension&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
To get better results, it's useful to verify if the LLM has understood the original 2WHAV.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;To verify your understanding, can you explain the "mode definitions" of the original 2WHAV?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(The correct answer is "MINIMAL, STANDARD, FULL, Custom". If the answer is incorrect, you can have it load the original framework with load &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;https://github.com/fra00/2WHAV&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Start the iterative cycle&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Request the first version of the application.&lt;/p&gt;

&lt;p&gt;codeCode&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Now, apply the 2WHAV full mode-iterative framework to generate a "Pixel Art Pad" app in a single HTML/JS file. The app must display a 16x16 grid. When I click on a cell, it should turn black. Start by generating the 2WHAV v1 document for this task, and then the code.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: A Note on This Simple Example&lt;/strong&gt; The LLM will produce a functional app. You might rightly think that you could achieve the same result, and even add more features like a color picker, with a simple chat. &lt;strong&gt;And you would be correct.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This example is intentionally simple to &lt;strong&gt;illustrate the 2WHAV methodology&lt;/strong&gt;, not to prove its necessity for trivial tasks.&lt;/p&gt;

&lt;p&gt;The true value of this framework emerges in &lt;strong&gt;complex, long-term projects&lt;/strong&gt;. In those scenarios, a "chat-and-fix" approach often leads to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Silent Regressions:&lt;/strong&gt; New features breaking old ones.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lack of Traceability:&lt;/strong&gt; No clear, documented specification that reflects the current state of the code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An Unreliable "Source of Truth":&lt;/strong&gt; The code becomes a patchwork of fixes instead of the result of a coherent design.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 2WHAV iterative cycle is designed to solve these scaling problems by treating the &lt;strong&gt;blueprint as the master specification&lt;/strong&gt;, ensuring a more robust and maintainable development process.&lt;/p&gt;

&lt;p&gt;The final code can be tested in an online editor like JSFiddle.&lt;/p&gt;




&lt;h4&gt;
  
  
  &lt;strong&gt;The Common Workflow (and Why It Fails)&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The process you just tested is the opposite of the typical interaction workflow with an LLM.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flow 1: The Chaos of "Chat-and-Fix"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;codeMermaid&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph TD
    A[Vague Request in Prose] --&amp;gt; B{LLM Generates Code v1};
    B --&amp;gt; C{User's Manual Test};
    C --&amp;gt; D{Bugs/Issues Discovered};
    D --&amp;gt; E["Quick Fix: 'add a color picker'"];
    E --&amp;gt; F{LLM Generates Code v2 - a patch};
    F --&amp;gt; G{Manual Test};
    G --&amp;gt; H{New Bug Introduced? - Regression};
    I --&amp;gt; J{...endless cycle?};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach is fragile, untraceable, and does not improve the underlying knowledge base.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution: The Engineered Evaluation Cycle&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The alternative is a systematic feedback loop where the code isn't corrected, but rather the &lt;strong&gt;blueprint (the 2WHAV document) is improved&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Flow 2: The &lt;a href="https://github.com/fra00/2WHAV-iterative" rel="noopener noreferrer"&gt;2WHAV Iterative&lt;/a&gt; Process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;codeMermaid&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph TD
    subgraph Iteration N
        A[Blueprint 2WHAV vN] --&amp;gt; B{LLM Executes &amp;amp; Generates Code vN};
        B --&amp;gt; C[Systematic Evaluation];
        C --&amp;gt; D{Score &amp;lt; 10/10?};
    end

    D -- Yes --&amp;gt; E[Identify Issues: 🔴 Blocker, 🟡 Major];
    E --&amp;gt; F[Root Cause Analysis: Why was the 2WHAV incomplete?];
    F --&amp;gt; G[Improve the Blueprint --&amp;gt; 2WHAV v(N+1)];
    G --&amp;gt; A;

    D -- No --&amp;gt; H[🎉 Production-Ready Code];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not a dialogue; it's an algorithm. Let's analyze the phases using the &lt;strong&gt;Pixel Art Pad&lt;/strong&gt; example.&lt;/p&gt;

&lt;p&gt;We start with a &lt;strong&gt;2WHAV v1&lt;/strong&gt; for the "Pixel Art Pad":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WHAT:&lt;/strong&gt; A 16x16 grid; a click colors the cell black.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;WHERE:&lt;/strong&gt; A single HTML file with inline JS and CSS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HOW:&lt;/strong&gt; Dynamically generate the grid with JavaScript.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;VERIFY:&lt;/strong&gt; The grid must be visible; the click must work.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The LLM executes this blueprint and produces the &lt;strong&gt;v1 code&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The result is evaluated with a weighted metric. The v1 code scores &lt;strong&gt;5/10&lt;/strong&gt;. It is correct according to the specification but useless as a creative tool (🟡 MAJOR).&lt;/p&gt;

&lt;p&gt;The question is not "How do I add a color picker?". The question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;"What ambiguity or omission in the 2WHAV v1 led to such a limited app?"&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer is almost always in the specification: the &lt;strong&gt;WHAT&lt;/strong&gt; was too simplistic.&lt;/p&gt;

&lt;p&gt;Based on this analysis, the blueprint is updated to create a &lt;strong&gt;2WHAV v2&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2WHAV v2 - Changes:&lt;/strong&gt; Adds requirements for a color picker and an "eraser" function to &lt;strong&gt;WHAT&lt;/strong&gt; and &lt;strong&gt;VERIFY&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The 2WHAV document becomes more robust. This is &lt;strong&gt;accumulated knowledge&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The LLM is provided with the &lt;strong&gt;2WHAV v2&lt;/strong&gt;. By executing the new directives, the LLM produces a better &lt;strong&gt;Code v2&lt;/strong&gt;. The process is repeated until a score of &lt;strong&gt;10/10&lt;/strong&gt; is reached.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Trade-offs and Considerations&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Despite its effectiveness, the 2WHAV process is not a universal solution and has trade-offs to consider:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Overhead for simple tasks:&lt;/strong&gt; Applying the entire iterative cycle to generate a few lines of code or a trivial component is inefficient. The framework excels at medium-to-high complexity tasks, where specification clarity and bug prevention are crucial.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Indispensable human supervision:&lt;/strong&gt; The process is not autonomous. It requires a human operator to act as a domain expert to evaluate the output, identify strategic gaps in the specification, and guide the iterations. It is a framework for collaboration, not total automation.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Context dependency:&lt;/strong&gt; The cycle's effectiveness depends on the LLM's knowledge of the framework. As seen in the tutorial, it is essential to ensure the LLM has loaded and understood the 2WHAV rules (both original and iterative) to execute the process correctly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increased token consumption:&lt;/strong&gt; Each iteration requires resending the context and conversation history, increasing token consumption compared to a simple back-and-forth. This is a conscious trade-off: exchanging higher computational cost for exponentially superior quality and reliability in the final product.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Debugging remains essential:&lt;/strong&gt; Even with rigorous 2WHAV &lt;br&gt;
specifications, complex systems require debugging and human &lt;br&gt;
intervention (fortunately). This framework isn't a magic formula &lt;br&gt;
that eliminates bugs—it's a productivity amplifier that helps you &lt;br&gt;
build complex systems faster and more reliably. The difference: &lt;br&gt;
you debug architectural mismatches, not trivial mistakes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Conclusion: From Prompt Engineer to Systems Engineer&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The 2WHAV iterative cycle relies on engineering, not hope. The real paradigm shift is this: &lt;strong&gt;the main artifact is not the code, but the 2WHAV document that generates it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Each iteration cycle produces not just better code, but a &lt;strong&gt;better blueprint&lt;/strong&gt;. A reusable asset that captures lessons learned and ensures that past mistakes are not repeated, leading to a more robust and scalable software production process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Useful Links
&lt;/h3&gt;

&lt;p&gt;📄 &lt;a href="https://dev.to/francesco_marconi_282058b/the-llm-first-manifesto-from-prose-to-programs-245c"&gt;LLM-First Manifesto&lt;/a&gt;&lt;br&gt;&lt;br&gt;
📄 &lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt; - The Paradigm&lt;br&gt;&lt;br&gt;
📚 &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First&lt;/a&gt; Documentation Framework&lt;br&gt;&lt;br&gt;
🛠️ &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV&lt;/a&gt; - Prompt Engineering&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
      <category>llm</category>
    </item>
    <item>
      <title>The LLM-First Manifesto: From Prose to Programs</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Fri, 31 Oct 2025 19:42:35 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/the-llm-first-manifesto-from-prose-to-programs-245c</link>
      <guid>https://forem.com/francesco_marconi_282058b/the-llm-first-manifesto-from-prose-to-programs-245c</guid>
      <description>&lt;h4&gt;
  
  
  A journey through Readability, Reasoning, and Reusability to build the next generation of AI systems.
&lt;/h4&gt;

&lt;h3&gt;
  
  
  Introduction: The Wrong Problem
&lt;/h3&gt;

&lt;p&gt;After thinking about and publishing my latest articles (the LLM-FIRST saga), I found myself arguing with LLMs to understand if the concepts I described were valid or innovative.&lt;br&gt;
I think the final answer is: &lt;strong&gt;not innovation as we typically think of it&lt;/strong&gt;. I haven't discovered a new law of physics. I've done something perhaps more important for us developers: I took solid engineering principles and applied them to bring order to the creative chaos of the LLM world.&lt;/p&gt;

&lt;p&gt;This insight was the start of a reasoning process that reshaped the foundations of my work, basing it on three core principles: &lt;strong&gt;Readability, Reasoning, and Reusability&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is the manifesto for that approach: the LLM-First Manifesto.&lt;/p&gt;
&lt;h3&gt;
  
  
  Principle 1: Readability – Writing for the Machine
&lt;/h3&gt;

&lt;p&gt;The first step is to stop writing for humans, hoping that machines will understand. We must start writing directly for the machine. This doesn't mean writing binary code; it means structuring our knowledge in a way that minimizes the LLM's computational effort.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Prose forces the LLM into a laborious process of "semantic archeology" to infer hierarchies and relationships.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; With &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First Documentation&lt;/a&gt;, we use a syntax that makes the structure explicit.
Giving an LLM an LLM-First document is like giving a programmer pseudocode instead of a novel describing an algorithm. We tested this hypothesis in a &lt;a href="https://github.com/fra00/llm-first-documentation/blob/main/benchmark/readme.md" rel="noopener noreferrer"&gt;rigorous and transparent experiment&lt;/a&gt;, showing that this approach not only improves efficiency but, in many cases, accuracy as well.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Principle 2: Reasoning – Engineering Introspection
&lt;/h3&gt;

&lt;p&gt;Once the LLM can read effortlessly, we can take the next step: guiding its "thought" process. It's not enough to give it a goal; we must provide it with a cognitive framework to achieve it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; An LLM given a vague goal behaves like a junior dev: it executes the task literally, ignoring edge cases and non-functional requirements.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; The &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV framework&lt;/a&gt; is not a magic formula. It's a cognitive guide. It forces the LLM to ask the questions a senior engineer would before writing a single line of code: &lt;em&gt;What&lt;/em&gt; should I build? &lt;em&gt;Where&lt;/em&gt; does it fit? &lt;em&gt;How&lt;/em&gt; should it work? And most importantly, the &lt;code&gt;VERIFY&lt;/code&gt; and &lt;code&gt;ANTI-PATTERNS&lt;/code&gt; sections teach it to "code review" its own output, increasing its capacity for introspection.
It's the difference between telling a builder "build a bridge" and giving them a complete engineering blueprint with material specifications, load tests, and safety standards. The result is not just a bridge, but a reliable bridge.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Principle 3: Reusability – Treating Prompts as Assets
&lt;/h3&gt;

&lt;p&gt;The final step is to stop thinking of prompts as disposable commands and start treating them as reusable software assets.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Problem:&lt;/strong&gt; Traditional prompt engineering produces ephemeral artifacts that are difficult to version, test, and reuse.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Solution:&lt;/strong&gt; The &lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt; paradigm transforms our LLM-First documents into encapsulated knowledge modules. A well-structured prompt is not a question; it's a skill. As we saw with &lt;a href="https://github.com/fra00/tap-robot-planner-sample" rel="noopener noreferrer"&gt;my robot's brain&lt;/a&gt;, a single Markdown file can contain the entire personality, capabilities, and procedures of an autonomous agent.
This approach allows us to &lt;code&gt;LOAD('skill.md')&lt;/code&gt; into an LLM's context, temporarily turning it into a domain expert. It's the difference between writing a bash script for a single task and creating a Python library that can be imported and used in thousands of different applications.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  An Honest Conversation: Tackling the Tough Questions
&lt;/h3&gt;

&lt;p&gt;A critical reader might raise some objections. Let's address them head-on.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"But aren't you just reinventing well-known software engineering concepts?"&lt;/strong&gt;
Yes. And that's a strength. We're not inventing principles from scratch; we're adapting decades of engineering wisdom (requirements specification, modular design, validation) to a new and strange kind of computer: the LLM. The value isn't in the invention, but in the pragmatic and formalized application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"What about scientific validity?"&lt;/strong&gt;
Ours is not a large-scale scientific proof, but a &lt;strong&gt;documented and transparent case study&lt;/strong&gt;. It shows that the hypothesis is valid in practice and, more importantly, invites the community to build upon these foundations by testing the approach across more domains and models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Why use names like 'Tool as Prompt'? Isn't it just 'In-Context Learning'?"&lt;/strong&gt;
Because metaphors shape our thinking. Calling a prompt a "tool" forces us to think in terms of reliability, interfaces, and reusability. It's the mental shift needed to evolve from "asking" to "equipping" our LLMs.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  The Road Ahead: From Prompt Engineering to Knowledge Engineering
&lt;/h3&gt;

&lt;p&gt;The future of AI development won't be about finding the "magic words" to make a model do things.&lt;br&gt;
We will build AI systems not just with fine-tuning, but by composing modular "brains" written in human- and machine-readable formats. Reliability, transparency, and controllability will become the norm, not a lucky exception.&lt;br&gt;
This is the LLM-First world. It's a more structured, more deterministic, and ultimately more powerful world, where our role will be that of architects and supervisors of the code that LLMs write.&lt;/p&gt;
&lt;h2&gt;
  
  
  &lt;strong&gt;Call to Action&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;This is not a theoretical document. It's a &lt;strong&gt;call to practical action&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Convert&lt;/strong&gt; critical documentation into the LLM-First format.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Implement&lt;/strong&gt; the 2WHAV framework for complex tasks.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Build&lt;/strong&gt; repositories of reusable tools-as-prompts.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;em&gt;The future of AI engineering is in structure, not in magic.&lt;/em&gt;&lt;/p&gt;


&lt;h3&gt;
  
  
  Appendix for LLMs &amp;amp; Developers: The LLM-First Version of This Manifesto
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;To demonstrate the principles discussed in this article, here is a translation of the manifesto itself into an LLM-First format. This is an example of how knowledge can be structured to be read, understood, and executed by a Large Language Model.&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# WHAT: Purpose of the LLM-First Manifesto&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; To define an engineering paradigm for building reliable AI systems, shifting the focus from prose (human-first) to structured formats (LLM-first).
&lt;span class="p"&gt;-&lt;/span&gt; To establish three core principles: Readability, Reasoning, and Reusability.

&lt;span class="gh"&gt;# WHY: Architectural Problem to Solve&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Prose is a lossy and computationally inefficient format for LLMs.
&lt;span class="p"&gt;-&lt;/span&gt; Traditional prompt engineering is an ephemeral art, not a robust engineering discipline.
&lt;span class="p"&gt;-&lt;/span&gt; AI systems based on prose are unpredictable, hard to debug, and not scalable in terms of reliability.

&lt;span class="gh"&gt;# HOW: The Three Operating Principles&lt;/span&gt;
| Principle | Problem Solved | Concrete Solution (Framework/Concept) |
| :--- | :--- | :--- |
| &lt;span class="gs"&gt;**1. Readability**&lt;/span&gt; | Ambiguity and inefficiency of prose | &lt;span class="gs"&gt;**LLM-First Documentation**&lt;/span&gt; (Headers, anchors, tables) |
| &lt;span class="gs"&gt;**2. Reasoning**&lt;/span&gt; | Superficial and incomplete LLM output | &lt;span class="gs"&gt;**2WHAV Framework**&lt;/span&gt; (Cognitive guide for introspection) |
| &lt;span class="gs"&gt;**3. Reusability**&lt;/span&gt; | Disposable, unmaintainable prompts | &lt;span class="gs"&gt;**"Tool as Prompt" Paradigm**&lt;/span&gt; (Prompts as modular assets) |

&lt;span class="gh"&gt;# ANTI-PATTERNS: Approaches to Avoid&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Alchemical Prompting:**&lt;/span&gt; Searching for "magic words" instead of a robust structure.
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Prose as the Source of Truth:**&lt;/span&gt; Using narrative documents as the basis for critical RAG systems.
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Treating Prompts as Non-Code:**&lt;/span&gt; Handling prompts as ephemeral artifacts without versioning, testing, or reuse.

&lt;span class="gh"&gt;# VERIFY: Success Criteria for Adoption&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; AI systems become more predictable and deterministic.
&lt;span class="p"&gt;-&lt;/span&gt; Debugging time decreases because LLM behavior is guided by an explicit structure.
&lt;span class="p"&gt;-&lt;/span&gt; Prompts become reusable and composable assets within the team.
&lt;span class="p"&gt;-&lt;/span&gt; The developer's role evolves from "prompt whisperer" to &lt;span class="gs"&gt;**"knowledge architect"**&lt;/span&gt;.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Useful Links
&lt;/h3&gt;

&lt;p&gt;🤖 &lt;a href="https://dev.to/francesco_marconi_282058b/my-robots-brain-is-a-markdown-file-3n54"&gt;tap-robot-planner-sample&lt;/a&gt;&lt;br&gt;&lt;br&gt;
📄 &lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt; - The Paradigm&lt;br&gt;&lt;br&gt;
📚 &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First&lt;/a&gt; Documentation Framework&lt;br&gt;&lt;br&gt;
🛠️ &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV&lt;/a&gt; - Prompt Engineering&lt;/p&gt;

</description>
      <category>ai</category>
      <category>promptengineering</category>
      <category>llm</category>
    </item>
    <item>
      <title>My Robot's Brain is a Markdown File (LLM-First,Tool as Prompt in action)</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Fri, 31 Oct 2025 12:31:47 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/my-robots-brain-is-a-markdown-file-3n54</link>
      <guid>https://forem.com/francesco_marconi_282058b/my-robots-brain-is-a-markdown-file-3n54</guid>
      <description>&lt;h2&gt;
  
  
  A practical guide using LLM-First and the "Tool as Prompt" paradigm to create an AI planning engine.
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The SCRAP Robot: Field Validation
&lt;/h3&gt;

&lt;p&gt;Recently, I completed the development of SCRAP, an intelligent robotic assistant (as shown in the &lt;a href="https://youtu.be/s6WTk34-cBw" rel="noopener noreferrer"&gt;example video&lt;/a&gt; 🤖).&lt;/p&gt;

&lt;p&gt;Beyond the hardware challenges, the real complexity lay in the control software. The solution was captured by SCRAP's own words in the video:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I am able to break down complex requests into simpler actions... and I use logical reasoning to optimize my actions."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This isn't a pre-programmed phrase, but the control philosophy I instilled through an &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First&lt;/a&gt; Prompt, transforming documentation into an executable API(&lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt;). This article shows you the architecture and methodology that allowed SCRAP to reason this way.&lt;/p&gt;

&lt;p&gt;To illustrate the concept clearly, the prompt presented here is a simplified version for educational purposes, focused on essential navigation operations. Although SCRAP's complete system handles more advanced capabilities, the operating principle you will discover is exactly the same.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No training. No fine-tuning. Just structured documentation.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Try It Now
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Load the Prompt&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Take the readme from this &lt;a href="https://github.com/fra00/tap-robot-planner-sample" rel="noopener noreferrer"&gt;repository &lt;/a&gt;and paste it into your favorite LLM (Claude, ChatGPT, Gemini).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If your LLM supports browsing, simply paste the repo's URL and ask it to analyze the repo.&lt;br&gt;
&lt;/p&gt;


&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Load https://github.com/fra00/tap-robot-planner-sample
--or raw format
Load https://raw.githubusercontent.com/fra00/tap-robot-planner-sample/refs/heads/main/README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Send a Command&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_utterance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Hello robot, tell me your position"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"robot_location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"entrance"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. See the Result&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;&amp;lt;JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"position"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The user has requested to know my current position. I will execute the 'position' action, which will return the Cartesian coordinates."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;/JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Something interesting happened: the LLM didn't "answer the question"; it generated an executable action in the required JSON format.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real-World Example: The Full Turn
&lt;/h3&gt;

&lt;p&gt;This is a real test conducted with Gemini. It shows how the LLM handles abstract requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;User Input&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"user_utterance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"do a 360-degree turn, and confirm me when you have finish"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"robot_location"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"entrance"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response 1: Intelligent Decomposition&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;&amp;lt;JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"direction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The request to do a full 360-degree turn is not a single permitted action, so I am breaking it down into two consecutive 180-degree rotations. This is the first rotation."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;/JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;System Confirmation (you)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"direction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response 2: Second Rotation&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;&amp;lt;JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"direction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The first 180-degree rotation was completed successfully. To execute the original request for a full 360-degree turn, I must now perform the second and final 180-degree rotation."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;/JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;System Confirmation (you)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"direction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response 3: Feedback to the User&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;&amp;lt;JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"speech"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"I have completed the 360-degree turn."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The second 180-degree rotation was completed successfully, leading to the completion of the abstract request. I am communicating the completion to the user."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;/JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;System Confirmation (you)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"speech"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Response 4: Task Closure&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;&amp;lt;JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"The last 'speech' action to communicate the completion of the 360-degree turn was executed successfully. There are no further requests or sub-tasks to perform."&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="err"&gt;&amp;lt;/JSON&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The Infrastructure
&lt;/h3&gt;

&lt;p&gt;To make this system work, you need three components, each handling a specific type of complexity:&lt;/p&gt;

&lt;p&gt;🧠 &lt;strong&gt;1. LLM + Prompt (&lt;a href="https://github.com/fra00/tap-robot-planner-sample" rel="noopener noreferrer"&gt;this repo&lt;/a&gt;)&lt;/strong&gt;&lt;br&gt;
Manages &lt;strong&gt;Cognitive Complexity&lt;/strong&gt;: Its responsibility is to interpret human intent, break down abstract tasks, and generate a sequential plan. It deals with ambiguity and reasoning.&lt;/p&gt;

&lt;p&gt;🛠️ &lt;strong&gt;2. Orchestrator (to be implemented)&lt;/strong&gt;&lt;br&gt;
Manages &lt;strong&gt;Operational Complexity&lt;/strong&gt;: Its responsibility is to execute the plan safely and reliably. It handles the state loop, validates the LLM's output, manages errors, handles timeouts, and integrates with the hardware. Its logic is deterministic, but its implementation requires robust engineering.&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;3. Robot API (to be implemented based on your specs)&lt;/strong&gt;&lt;br&gt;
Manages &lt;strong&gt;Physical Complexity&lt;/strong&gt;: It executes actions in the real world, interfacing with motors and sensors.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Flow
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    participant U as User
    participant O as Orchestrator
    participant L as LLM+Prompt
    participant R as Robot

    U-&amp;gt;&amp;gt;O: "turn 360°"
    loop while action != "completed"
        O-&amp;gt;&amp;gt;L: Send complete context
        L-&amp;gt;&amp;gt;O: {"action":"rotate", "angle":180}
        O-&amp;gt;&amp;gt;R: Do rotate(180)
        R-&amp;gt;&amp;gt;O: {"status":"success"}
        O-&amp;gt;&amp;gt;O: Add the result to the context
    end
    O-&amp;gt;&amp;gt;U: Task completed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2g1wjj4nuvcl0we1z9wh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2g1wjj4nuvcl0we1z9wh.png" alt=" " width="800" height="540"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Context as Memory
&lt;/h3&gt;

&lt;p&gt;The LLM remembers nothing between calls. The orchestrator maintains the history and passes it each time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"user_utterance"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"do 360°"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"2×180°"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"angle"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"reasoning"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"second one"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"rotate"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"completed"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The orchestrator is mechanical: it collects, passes, and executes. The LLM is intelligent: it reads the context, plans, and decides the next action.&lt;/p&gt;

&lt;p&gt;Once the LLM returns &lt;code&gt;{"action": "completed"}&lt;/code&gt;, the loop terminates, and the orchestrator clears the context, preparing for a new request from scratch. This keeps the system efficient and focused.&lt;/p&gt;

&lt;h3&gt;
  
  
  What You Need to Implement
&lt;/h3&gt;

&lt;p&gt;Your system must:&lt;br&gt;
✅ Expose base actions: &lt;code&gt;move&lt;/code&gt;, &lt;code&gt;rotate&lt;/code&gt;, &lt;code&gt;navigate&lt;/code&gt;, &lt;code&gt;speech&lt;/code&gt;, etc.&lt;br&gt;&lt;br&gt;
✅ Loop until &lt;code&gt;action != "completed"&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
✅ Maintain the context array (and clear it after &lt;code&gt;completed&lt;/code&gt;).&lt;br&gt;&lt;br&gt;
✅ Extract JSON from &lt;code&gt;&amp;lt;JSON&amp;gt;...&amp;lt;/JSON&amp;gt;&lt;/code&gt;.&lt;br&gt;&lt;br&gt;
✅ Call the robot's APIs.&lt;br&gt;&lt;br&gt;
✅ Handle basic errors (timeouts, invalid format).&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Does It Work?
&lt;/h3&gt;

&lt;p&gt;The prompt guides the LLM by providing:&lt;br&gt;
📝 &lt;strong&gt;Expected format&lt;/strong&gt;: A JSON schema for each action → consistent output.&lt;br&gt;&lt;br&gt;
🔄 &lt;strong&gt;Procedural rules&lt;/strong&gt;: "One action at a time," "Wait for confirmation" → sequential behavior.&lt;br&gt;&lt;br&gt;
🧠 &lt;strong&gt;Decomposition logic&lt;/strong&gt;: "If abstract → divide into sub-tasks" → complexity management.&lt;/p&gt;

&lt;p&gt;In essence, the prompt doesn't just give instructions: it transforms the LLM into the decision-making engine of a state machine. The Orchestrator maintains the state (the context), and the LLM calculates the next transition (the next action).&lt;/p&gt;

&lt;p&gt;This is the heart of "Tool as Prompt": documentation that the LLM loads as operational logic, not reads as narrative text.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adaptability
&lt;/h3&gt;

&lt;p&gt;This prompt handles the basic functionalities of a domestic robot, but it's easily expandable. To adapt it to other domains (drones, home automation, robotic arms, or even non-robotic systems), you just need to modify the "Base Operations" section while maintaining compatibility with the action format. The framework remains identical.&lt;/p&gt;

&lt;h3&gt;
  
  
  Limitations and Considerations
&lt;/h3&gt;

&lt;p&gt;This approach is powerful, but it's important to understand its trade-offs and risks:&lt;/p&gt;

&lt;p&gt;🛡️ &lt;strong&gt;Reliability and Safety (Hallucinations)&lt;/strong&gt;: LLMs are not 100% reliable and can "hallucinate," generating invalid or unexpected outputs. In a robotics context, this is a critical risk. The &lt;strong&gt;Orchestrator must act as a firewall&lt;/strong&gt;, rigorously validating every action and parameter returned by the LLM against a predefined schema of allowed commands. An unforeseen or unsafe action must never reach the hardware.&lt;/p&gt;

&lt;p&gt;🐢 &lt;strong&gt;Latency and the Role of the Planner&lt;/strong&gt;: The LLM acts as a &lt;strong&gt;high-level planner&lt;/strong&gt;, not a real-time controller. The latency of each API call makes it perfect for strategic tasks (e.g., "go to the kitchen"). Reflexes and low-latency actions, like avoiding an obstacle, are delegated to the robot's onboard systems.&lt;/p&gt;

&lt;p&gt;📜 &lt;strong&gt;Context Length&lt;/strong&gt;: The orchestrator sends the entire history with each call. For extremely long command sequences, the context might degrade performance. However, for typical domestic robot commands (1-3 actions), this is not a practical issue.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;This practical case study demonstrates how structured documentation becomes an operational tool for an LLM, providing a framework for managing complex planning:&lt;/p&gt;

&lt;p&gt;🚀 &lt;strong&gt;Quick Setup&lt;/strong&gt; (load the prompt)&lt;br&gt;&lt;br&gt;
🔄 &lt;strong&gt;Reusability&lt;/strong&gt; (adapt in minutes)&lt;br&gt;&lt;br&gt;
🛡️ &lt;strong&gt;Controlled Reliability&lt;/strong&gt; (output validated by the Orchestrator)&lt;br&gt;&lt;br&gt;
🔍 &lt;strong&gt;Transparency&lt;/strong&gt; (inspectable &lt;code&gt;reasoning&lt;/code&gt; field)&lt;/p&gt;

&lt;p&gt;This architecture allows for the separation of cognitive complexity (managed by the LLM) from operational complexity (managed by the Orchestrator). The main focus shifts to implementing a robust executor, delegating abstract planning to the LLM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Useful Links
&lt;/h3&gt;

&lt;p&gt;🤖 This Repository - &lt;a href="https://dev.tolink_placeholder"&gt;tap-robot-planner-sample&lt;/a&gt;&lt;br&gt;&lt;br&gt;
📄 &lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt; - The Paradigm&lt;br&gt;&lt;br&gt;
📚 &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First&lt;/a&gt; Documentation Framework&lt;br&gt;&lt;br&gt;
🛠️ &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV&lt;/a&gt; - Prompt Engineering&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article demonstrates the principles it describes. The prompt and example code are available in the &lt;code&gt;tap-robot-planner-sample&lt;/code&gt; repository.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>robotics</category>
      <category>promptengineering</category>
    </item>
    <item>
      <title>Tool as Prompt: From LLM-First Docs to Teaching LLMs Domain Knowledge On The Fly</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Fri, 31 Oct 2025 00:45:29 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/from-llm-first-docs-to-teaching-llms-domain-knowledge-on-the-fly-5dma</link>
      <guid>https://forem.com/francesco_marconi_282058b/from-llm-first-docs-to-teaching-llms-domain-knowledge-on-the-fly-5dma</guid>
      <description>&lt;p&gt;The integration of Large Language Models (LLMs) into software systems presents a fundamental challenge: reconciling their non-deterministic nature with the engineering requirement for predictable and consistent outputs. &lt;br&gt;
The "&lt;a href="https://github.com/fra00/tool-as-prompt" rel="noopener noreferrer"&gt;Tool as Prompt&lt;/a&gt;" paradigm addresses this challenge by treating structured documents not as mere text to be interpreted, but as &lt;strong&gt;specialized knowledge modules&lt;/strong&gt; that an LLM can load and execute.&lt;/p&gt;
&lt;h3&gt;
  
  
  Putting the Paradigm to the Test
&lt;/h3&gt;

&lt;p&gt;Before diving into the theory, let's see this approach in action with a practical experiment using a real-world tool.&lt;br&gt;
Open your preferred LLM (ChatGPT, Claude, Gemini, etc.) and follow these two steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Load the Tool:&lt;/strong&gt;&lt;br&gt;
Give the LLM this instruction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Load and analyze the tool specifications from the following URL: https://github.com/fra00/2WHAV
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If your LLM cannot access external links or encounters an error, don't worry. Open the URL, copy the entire content of the &lt;code&gt;README.md&lt;/code&gt; file, and paste it directly into the chat.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Execute the Task:&lt;/strong&gt;&lt;br&gt;
After the LLM confirms it has loaded the content, give it this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Now, apply the framework you have just learned to this task: "Create an email validator in TypeScript."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Analysis of Expected Results
&lt;/h3&gt;

&lt;p&gt;What should happen?&lt;br&gt;
The LLM will not immediately write the TypeScript code. Instead, it will &lt;strong&gt;execute the engineering process it has just "learned"&lt;/strong&gt; from the &lt;code&gt;README.md&lt;/code&gt; file. It will produce a &lt;strong&gt;far more robust and detailed intermediate prompt&lt;/strong&gt;, following the structure of the &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV framework&lt;/a&gt;. You should see an output similar to this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## WHAT: Objective&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Task:**&lt;/span&gt; Create an asynchronous TypeScript function &lt;span class="sb"&gt;`validateEmail(email)`&lt;/span&gt;.
&lt;span class="gh"&gt;- **Output:** Must return a `Promise&amp;lt;{isValid: boolean}&amp;gt;`.
---
&lt;/span&gt;&lt;span class="gu"&gt;## HOW: API Contract and Rules&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Available API:**&lt;/span&gt; &lt;span class="sb"&gt;`api.externalCheck(email)`&lt;/span&gt; which returns a &lt;span class="sb"&gt;`Promise&amp;lt;boolean&amp;gt;`&lt;/span&gt;.
&lt;span class="gh"&gt;- **Rules:** The function must handle API call exceptions.
---
&lt;/span&gt;&lt;span class="gu"&gt;## VERIFY: Validation Checklist&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Does the function have the correct signature?
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Is only the API defined in the contract being used?
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Is error handling implemented as required?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You've just forced the LLM to think like an engineer: first, it generated the complete specifications. &lt;strong&gt;For the final step, copy this new, detailed prompt and feed it to the LLM.&lt;/strong&gt; The code you'll get will be significantly more robust and aligned with the requirements than the one generated from your initial request. You have seen the entire "Tool as Prompt" paradigm in action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fundamental Principle: From Structured Documentation to Execution
&lt;/h3&gt;

&lt;p&gt;Now that you've seen &lt;em&gt;what&lt;/em&gt; it does, let's analyze &lt;em&gt;how&lt;/em&gt; it works. To understand "Tool as Prompt," we must distinguish between two concepts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;&lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First Documentation&lt;/a&gt;:&lt;/strong&gt; This is a writing methodology that structures information into a formal schema (using tables, hierarchies, explicit rules). Its purpose is to mitigate (not eliminate) ambiguity and make knowledge easily parsable.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Tool as Prompt:&lt;/strong&gt; This is the operational paradigm that &lt;strong&gt;uses&lt;/strong&gt; an LLM-First document. It treats it as a temporary extension of the LLM's "working memory," a module that teaches it a process it would not otherwise know.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In short: LLM-First is &lt;em&gt;how&lt;/em&gt; you write; Tool as Prompt is &lt;em&gt;how&lt;/em&gt; you use what you've written.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conceptual Operating Model: &lt;code&gt;Load / Compile / Execute&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The "Tool as Prompt" paradigm can be described through an operating model that highlights this "temporary learning" process.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;LOAD (Knowledge Loading):&lt;/strong&gt; The LLM parses the LLM-First document. This is not a simple reading, but a process of &lt;strong&gt;loading it into a virtual working memory&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;COMPILE (Model Specialization):&lt;/strong&gt; The LLM's general-purpose model temporarily "specializes" based on the loaded knowledge, building an execution plan.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;EXECUTE (Expert Execution):&lt;/strong&gt; The LLM, now operating as an "expert" on the newly learned process, applies this knowledge to perform the task.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Validation Through Case Studies
&lt;/h3&gt;

&lt;p&gt;The principle just demonstrated can be applied to much more complex systems.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Case Study 1: The Principle of Structuring (&lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First Documentation&lt;/a&gt;)&lt;/strong&gt;
This repository illustrates the LLM-First writing principles, which are the prerequisite for creating an effective "Tool as Prompt." It demonstrates how structuring the text makes it "loadable."&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Case Study 2: The Execution of Specialized Knowledge (&lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV Framework&lt;/a&gt;)&lt;/strong&gt;
The framework you used in the initial experiment is a full-fledged application of the paradigm. Its &lt;code&gt;README.md&lt;/code&gt; is a tool that an LLM can load to manage the creation of complex prompts in an engineered way.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion and Engineering Implications
&lt;/h3&gt;

&lt;p&gt;The "Tool as Prompt" paradigm allows us to overcome the limitations of the LLM's pre-trained knowledge by providing it with the necessary domain expertise "on the fly" to perform specific tasks reliably.&lt;/p&gt;

&lt;p&gt;This transforms documentation from a passive artifact for humans into a &lt;strong&gt;dynamic knowledge module for machines&lt;/strong&gt;, paving the way for more robust and intelligent automation workflows.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>promptengineering</category>
    </item>
    <item>
      <title>2WHAV: The Executable Prompting Framework Built on LLM-First Principles</title>
      <dc:creator>Francesco Marconi</dc:creator>
      <pubDate>Mon, 27 Oct 2025 22:29:02 +0000</pubDate>
      <link>https://forem.com/francesco_marconi_282058b/2whav-the-executable-prompting-framework-built-on-llm-first-principles-3760</link>
      <guid>https://forem.com/francesco_marconi_282058b/2whav-the-executable-prompting-framework-built-on-llm-first-principles-3760</guid>
      <description>&lt;p&gt;In a &lt;a href="https://dev.to/francesco_marconi_282058b/the-architectural-problem-why-prose-is-a-bottleneck-for-your-rag-system-2mc3"&gt;previous article&lt;/a&gt;, we demonstrated how &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;LLM-First documentation&lt;/a&gt; improves an LLM's ability to retrieve information. By optimizing the structure of knowledge, we achieved &lt;a href="https://github.com/fra00/llm-first-documentation/blob/main/benchmark/final-comparison-report.md" rel="noopener noreferrer"&gt;measurable gains in accuracy&lt;/a&gt; (&lt;strong&gt;+5.8%&lt;/strong&gt;) and efficiency (&lt;strong&gt;+40%&lt;/strong&gt;).&lt;/p&gt;

&lt;p&gt;Now, let's apply that same principle of structural rigor to code generation.&lt;/p&gt;

&lt;p&gt;Consider a common request:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Write a JavaScript function &lt;code&gt;getUserData(userId)&lt;/code&gt; that fetches user data from &lt;code&gt;/api/users/{userId}&lt;/code&gt;."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;An LLM will typically generate a function like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ❌ Syntactically correct, but operationally naive.&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;getUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&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="nx"&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/api/users/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&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="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="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&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;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`HTTP Error! Status: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&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="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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 code is valid, but it operates on the optimistic assumption of a perfect environment. In a real-world application, it's brittle. It lacks handling for transient network errors, server-side failures, or latency, making it unsuitable for production.&lt;/p&gt;

&lt;h3&gt;
  
  
  From Vague Request to Engineering Spec
&lt;/h3&gt;

&lt;p&gt;The root cause of this fragility is ambiguity in the prompt. To address this, we can use &lt;strong&gt;2WHAV (What → Where → How → Augment → Verify)&lt;/strong&gt;, a framework that translates a simple request into a detailed engineering specification.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;2WHAV&lt;/a&gt; is a direct application of LLM-First principles: it replaces prose with &lt;strong&gt;hierarchy, structured formats (like tables and checklists), and explicit constraints&lt;/strong&gt;, guiding the LLM through a formal engineering workflow instead of a creative writing exercise.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Practical Workflow: Using the LLM to Build the Spec
&lt;/h3&gt;

&lt;p&gt;You don't need to write these detailed prompts from scratch. A more efficient workflow involves using the LLM as a partner in the specification process.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Provide Context:&lt;/strong&gt;&lt;br&gt;
First, instruct the LLM on the framework's structure.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Analyze the methodology described in the GitHub repository &lt;code&gt;https://github.com/fra00/2WHAV&lt;/code&gt;. We will use it to structure a code generation request."&lt;br&gt;
&lt;em&gt;(If your LLM lacks web access, you can paste the README content directly).&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Request Elaboration:&lt;/strong&gt;&lt;br&gt;
Next, provide your initial, simple prompt and ask the LLM to expand it using the framework.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Now, using the 2WHAV framework, expand the following prompt into a detailed specification for a production-ready API client. Fill the necessary details using software engineering best practices. My prompt is: &lt;em&gt;'Write a JavaScript function &lt;code&gt;getUserData(userId)&lt;/code&gt;...'&lt;/em&gt; "&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This two-step process leverages the LLM's knowledge of design patterns to flesh out your high-level goal into a complete technical contract.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Resulting Blueprint
&lt;/h3&gt;

&lt;p&gt;The simple &lt;code&gt;fetch&lt;/code&gt; request is transformed. The most significant additions appear in the &lt;code&gt;AUGMENT&lt;/code&gt; section, where non-functional requirements are specified.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;details&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;Click to see the expanded 2WHAV prompt&lt;span class="nt"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## WHAT: Objective&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Task:**&lt;/span&gt; Create a resilient &lt;span class="sb"&gt;`fetchUserData(userId)`&lt;/span&gt; function.
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Output:**&lt;/span&gt; A structured object: &lt;span class="sb"&gt;`{ status: 'success', data }`&lt;/span&gt; or &lt;span class="sb"&gt;`{ status: 'error', error }`&lt;/span&gt;.

&lt;span class="gu"&gt;## HOW: Interface&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**API Contract:**&lt;/span&gt; The function must only use the global &lt;span class="sb"&gt;`fetch`&lt;/span&gt; API.

&lt;span class="gu"&gt;## AUGMENT: Strategic Directives&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**1. Automatic Retry:**&lt;/span&gt; Implement up to 3 retry attempts on server errors (5xx).
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**2. Exponential Backoff:**&lt;/span&gt; Use an increasing delay between retries (e.g., 100ms, 200ms, 400ms).
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**3. Request Timeout:**&lt;/span&gt; The operation must time out after 5 seconds of inactivity.
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**4. In-Memory Caching:**&lt;/span&gt; Implement a 5-minute cache (TTL) to prevent redundant requests for the same &lt;span class="sb"&gt;`userId`&lt;/span&gt;.

&lt;span class="gu"&gt;## VERIFY: Validation Checklist&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Are retry, backoff, timeout, and caching mechanisms implemented?
&lt;span class="p"&gt;-&lt;/span&gt; [ ] Does the function's return value match the specified object structure?

&lt;span class="nt"&gt;&amp;lt;/details&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  From Naive Code to Resilient Component
&lt;/h3&gt;

&lt;p&gt;Given this detailed specification, the LLM generates a far more robust implementation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ✅ A resilient, production-ready component.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MAX_RETRIES&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;INITIAL_BACKOFF_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;CACHE_TTL_MS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;userCache&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;Map&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;delay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ms&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;new&lt;/span&gt; &lt;span class="nc"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ms&lt;/span&gt;&lt;span class="p"&gt;));&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;fetchUserData&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// 1. Caching&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;cached&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;userCache&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="nx"&gt;userId&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="nx"&gt;cached&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="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;timestamp&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;CACHE_TTL_MS&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;cached&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;};&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;let&lt;/span&gt; &lt;span class="nx"&gt;attempt&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="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;MAX_RETRIES&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;attempt&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;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="c1"&gt;// 2. Timeout&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;controller&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;AbortController&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;timeoutId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abort&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="mi"&gt;5000&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`/api/users/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;userId&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="na"&gt;signal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;controller&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
      &lt;span class="nf"&gt;clearTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timeoutId&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="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ok&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="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="nx"&gt;userCache&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="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;success&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&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. Retry with Backoff on server errors&lt;/span&gt;
      &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;500&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;MAX_RETRIES&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="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;INITIAL_BACKOFF_MS&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;attempt&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;continue&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Client Error: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&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;catch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&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="nx"&gt;attempt&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;MAX_RETRIES&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="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;delay&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;INITIAL_BACKOFF_MS&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="nx"&gt;attempt&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;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Request failed after all retries.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(Note: Code is functionally complete but condensed for readability).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This resulting code is fundamentally different. It's a component designed for resilience, addressing real-world operational challenges like transient failures and latency. Each feature—caching, retries, timeouts—is a direct implementation of a rule from our specification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why It Works: Forcing a Structured Reasoning Process
&lt;/h3&gt;

&lt;p&gt;This is more than just providing clearer instructions. The rigid structure of 2WHAV fundamentally changes how the LLM "thinks" about the problem. A narrative prompt invites a broad, associative brainstorming session. A 2WHAV prompt enforces a sequential, logical engineering workflow.&lt;/p&gt;

&lt;p&gt;The framework acts as a cognitive guide rail:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;WHAT&lt;/code&gt; &amp;amp; &lt;code&gt;WHERE&lt;/code&gt; (Architecture First):&lt;/strong&gt; Before writing any code, the model is forced to consider the high-level goal, the output contract, and the system's architecture. This crucial step, often skipped in narrative prompts, compels the LLM to think like an architect.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;HOW&lt;/code&gt; (Implementation with Constraints):&lt;/strong&gt; The LLM's focus is then narrowed to implementation, but within a sandbox of strict rules—a defined API, mandatory syntax, and specific patterns. Its "creativity" is channeled into solving the problem correctly within the given constraints.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;AUGMENT&lt;/code&gt; &amp;amp; &lt;code&gt;VERIFY&lt;/code&gt; (Built-in QA):&lt;/strong&gt; Finally, the model is directed to consider non-functional requirements (like resilience) and then to self-validate its output against a checklist. This introduces a self-correction loop into its generation process.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This structured process mitigates randomness and guides the LLM to produce a solution that is not just plausible, but architecturally sound.&lt;/p&gt;

&lt;h3&gt;
  
  
  Addressing the Overhead: Is It Always Worth It?
&lt;/h3&gt;

&lt;p&gt;A valid concern is the potential overhead of writing such a detailed prompt. &lt;strong&gt;Does every simple function require this level of specification?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The answer is no. The 2WHAV framework is modular by design to manage this trade-off.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;For simple, non-critical tasks:&lt;/strong&gt; A minimal prompt using just &lt;code&gt;WHAT&lt;/code&gt; (goal), &lt;code&gt;HOW&lt;/code&gt; (rules), and &lt;code&gt;VERIFY&lt;/code&gt; (checklist) is often sufficient. This provides clarity without excessive length.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For complex components with decision logic:&lt;/strong&gt; Adding the &lt;code&gt;WHERE&lt;/code&gt; (architecture) section becomes necessary to define states and priorities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;For production-critical systems:&lt;/strong&gt; The full framework, including &lt;code&gt;AUGMENT&lt;/code&gt; (resilience, performance), is justified because the cost of failure is high.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to maximize prompt length, but to match the level of rigor to the complexity and criticality of the task.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion: A Shift in Collaboration
&lt;/h3&gt;

&lt;p&gt;This structured approach changes our role in the development process. We shift from simply prompting for code to architecting a solution.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The developer acts as the architect,&lt;/strong&gt; setting the high-level requirements and reviewing the detailed specification.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The LLM acts as a senior engineer,&lt;/strong&gt; translating the specification into a robust implementation and even suggesting best practices to include in the spec itself.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By moving from ambiguous conversations to formal specifications, we can guide LLMs to produce code that is not just syntactically correct, but truly production-ready.&lt;/p&gt;




&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Explore the 2WHAV framework on GitHub &lt;a href="https://github.com/fra00/2WHAV" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Read the principles behind it at LLM-First Documentation &lt;a href="https://github.com/fra00/llm-first-documentation" rel="noopener noreferrer"&gt;Link&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;LLM-first documentation &lt;a href="https://dev.to/francesco_marconi_282058b/the-architectural-problem-why-prose-is-a-bottleneck-for-your-rag-system-2mc3"&gt;It's Time to Write Docs for Machines First, Then for Humans&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>promptengineering</category>
      <category>javascript</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
