<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Gary Zavaleta</title>
    <description>The latest articles on DEV Community by Gary Zavaleta (@gary_zavaleta_feddd55f2a0).</description>
    <link>https://dev.to/gary_zavaleta_feddd55f2a0</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3579913%2F0f2ae4b0-4993-45ad-b21e-4e0a9ba81060.png</url>
      <title>DEV Community: Gary Zavaleta</title>
      <link>https://dev.to/gary_zavaleta_feddd55f2a0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gary_zavaleta_feddd55f2a0"/>
    <language>en</language>
    <item>
      <title>I got tired of LLM drift breaking my apps, so I built an open-source fix</title>
      <dc:creator>Gary Zavaleta</dc:creator>
      <pubDate>Fri, 21 Aug 2026 04:06:53 +0000</pubDate>
      <link>https://dev.to/gary_zavaleta_feddd55f2a0/i-got-tired-of-llm-drift-breaking-my-apps-so-i-built-an-open-source-fix-22ee</link>
      <guid>https://dev.to/gary_zavaleta_feddd55f2a0/i-got-tired-of-llm-drift-breaking-my-apps-so-i-built-an-open-source-fix-22ee</guid>
      <description>&lt;p&gt;If you have been building with Large Language Models over the last year, you have probably hit the same wall I did: &lt;strong&gt;LLM Drift.&lt;/strong&gt; The agent reinvents your codebase, renames your files, and apologizes in bullet points. The AI model or coding tool did not get worse. Your context did.&lt;/p&gt;

&lt;p&gt;I stopped fighting drift with smarter prompts. I fight it with five small files and a loop. This post shows the whole system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Direct beats meta
&lt;/h2&gt;

&lt;p&gt;Abstract instructions drift. Concrete instructions do not. Compare:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meta:&lt;/strong&gt; "You are an expert Python developer. Write clean, Pythonic, robust code. Follow PEP 8 and best practices. Handle errors gracefully."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Direct:&lt;/strong&gt; "Use Python 3.12 and uv. Type-hint all public functions. Validate inputs with Pydantic models in src/schemas.py. Copy the repository pattern from src/db/user_repo.py. Name tests tests/test_*.py. Run ruff check . &amp;amp;&amp;amp; uv run pytest -q before each commit."&lt;/p&gt;

&lt;p&gt;Every direct line is checkable. The code has type hints or it does not. Nothing in "clean and robust" is checkable. After twenty turns, the AI's idea of "clean" is not yours anymore. That gap is the drift.&lt;/p&gt;

&lt;h2&gt;
  
  
  The files
&lt;/h2&gt;

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

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;BRD.md and PRD.md&lt;/strong&gt;: you fill these from templates. You, not the AI (or ask AI to use the templates based on your initial writing). They force you to know what you want.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;generate-agents.md&lt;/strong&gt;: a prompt. It reads your PRD and generates hierarchical &lt;a href="https://agents.md/" rel="noopener noreferrer"&gt;AGENTS.md&lt;/a&gt; files: a small root file, detailed sub-folder files. It also generates &lt;strong&gt;TASKS.md&lt;/strong&gt;: milestones as sections, tasks as checkboxes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;content-in/&lt;/strong&gt; and &lt;strong&gt;content-out/&lt;/strong&gt;: inputs you write, outputs the AI writes. Every artifact has a fixed place and a fixed name.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The task loop
&lt;/h2&gt;

&lt;p&gt;One task = one checkbox line in TASKS.md = one branch = one PR. If a task is too big for one PR, split the task list, not the PR.&lt;/p&gt;

&lt;p&gt;For each task:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Plan&lt;/strong&gt; (plan mode):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ultrathink the requirement @content-in/req.md. Ask as many questions as you need.
Save the plan in content-out. Use the name YYYYMMDD-TOPIC-PLAN.md.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;2. Implement&lt;/strong&gt; (auto mode):&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Ultracode the plan @content-out/YYYYMMDD-TOPIC-PLAN.md.
Create a branch and a PR for this task.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;3. Record:&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;Write an implementation record of all the work you did. Save it in content-out.
Use the name YYYYMMDD-TOPIC-RECORD.md. Include the record in the PR.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;4. Review in another model:&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;Review the implementation in PR #XX. The requirement is @content-in/req.md.
The plan is @content-out/...-PLAN.md. The record is @content-out/...-RECORD.md.
Review the code as well.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Tick the task. Take the next one. The dated plan and record give you a paper trail: requirement → plan → code → record → review. When something drifts, you can see where.&lt;/p&gt;
&lt;h2&gt;
  
  
  The rules that start arguments
&lt;/h2&gt;

&lt;p&gt;These guidelines can be added to your AGENTS.md or CLAUDE.md as well.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Banned words:&lt;/strong&gt; "delve", "seamless", "leverage", "robust", "comprehensive", "crucial". If the AI writes them, the AI is padding. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I write prompts like aircraft manuals.&lt;/strong&gt; ASD-STE100 is the Simplified Technical English standard from aerospace: sentences of 20 words or less, active voice, one instruction per sentence. Aviation solved unambiguous instructions decades ago. Borrow it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Do not preserve backward compatibility.&lt;/strong&gt; Delete the old path when you replace it. Dead code is drift fuel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never let a model grade its own homework.&lt;/strong&gt; The review step runs in a &lt;em&gt;different&lt;/em&gt; model. Same-model review confirms; cross-model review finds.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Receipts
&lt;/h2&gt;

&lt;p&gt;I ran the framework on itself. The latest improvement went requirement → plan → implementation → record, and the record sits in the PR description: &lt;a href="https://github.com/garyzava/avoid-llm-drift/pull/1" rel="noopener noreferrer"&gt;PR #1&lt;/a&gt;.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/garyzava" rel="noopener noreferrer"&gt;
        garyzava
      &lt;/a&gt; / &lt;a href="https://github.com/garyzava/avoid-llm-drift" rel="noopener noreferrer"&gt;
        avoid-llm-drift
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Avoiding LLM Drift When Using AI Coding Assistants&lt;/h1&gt;
&lt;/div&gt;

&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/garyzava/avoid-llm-drift/assets/workflow.png"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fraw.githubusercontent.com%2Fgaryzava%2Favoid-llm-drift%2FHEAD%2Fassets%2Fworkflow.png" alt="avoid-llm-drift: files and flow"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The way we code with AI assistants has evolved with the rise of agentic coding. Direct instructions beat meta (abstract) ones and using multiple lean instructions helps avoid LLM drift (this means when AI stops listening to you).&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Meta: "You are an expert Python developer. Write clean, Pythonic, robust code. Follow PEP 8 and best practices. Handle errors gracefully."&lt;/li&gt;
&lt;li&gt;Direct: "Use Python 3.12 and uv. Type-hint all public functions. Validate inputs with Pydantic models in src/schemas.py. Copy the repository pattern from src/db/user_repo.py. Name tests tests/test_*.py. Run ruff check . &amp;amp;&amp;amp; uv run pytest -q before each commit."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, you still need a controlled way to provide context and maintain a shared state across sessions.&lt;/p&gt;

&lt;p&gt;Coding agents perform better when instructions explicitly cover:&lt;/p&gt;


&lt;ul&gt;

&lt;li&gt;Problem statement, target users &amp;amp; JTBD (Jobs to Be Done), scope vs non-scope&lt;/li&gt;

&lt;li&gt;Acceptance criteria (what “done” means)&lt;/li&gt;

&lt;li&gt;…&lt;/li&gt;

&lt;/ul&gt;&lt;/div&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/garyzava/avoid-llm-drift" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Copy the templates. Bend the folder structure to your stack; a Python repo and a JavaScript repo need different folders. If it helps, star it.&lt;/p&gt;

&lt;p&gt;What is your rule for keeping agents on track? Tell me the one thing that actually stopped drift for you.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>devops</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
