<?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: Carlo Carbonell</title>
    <description>The latest articles on DEV Community by Carlo Carbonell (@carlow).</description>
    <link>https://dev.to/carlow</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%2F4183509%2F445ba782-4456-4cdb-ade4-8b780ff01414.jpg</url>
      <title>DEV Community: Carlo Carbonell</title>
      <link>https://dev.to/carlow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/carlow"/>
    <language>en</language>
    <item>
      <title>Why your AI coding agent contradicts itself in session 5 (and the three-file fix)</title>
      <dc:creator>Carlo Carbonell</dc:creator>
      <pubDate>Wed, 14 Oct 2026 04:04:36 +0000</pubDate>
      <link>https://dev.to/carlow/why-your-ai-coding-agent-contradicts-itself-in-session-5-and-the-three-file-fix-1742</link>
      <guid>https://dev.to/carlow/why-your-ai-coding-agent-contradicts-itself-in-session-5-and-the-three-file-fix-1742</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclosure: this article was drafted with an AI assistant (Claude). #ABotWroteThis&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An AI coding agent starts every session knowing nothing about the last one. That one fact explains most of the "the agent contradicts itself" complaints. It is not a bad model. It has no memory, and you are the only thing connecting session 1 to session 5.&lt;/p&gt;

&lt;p&gt;Here is a setup that moves that memory out of your head and into files the agent reads. It is three small files, one short prompt, and one rule for risky work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The two failures
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Context loss.&lt;/strong&gt; You open a new session and retype the project background from memory. You drop a constraint without noticing, so the output is wrong in a way you only discover later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reopened decisions.&lt;/strong&gt; Picture a pricing page. You settled on three tiers after thinking it through. A fresh session sees an unfinished page, proposes two tiers, and has no way to know why you chose three. You either re-argue it or accept the regression.&lt;/p&gt;

&lt;p&gt;Both come from the same place: the reasoning behind the project lives in your head or in a chat that is now closed.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: three layers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Holds&lt;/th&gt;
&lt;th&gt;Changes&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Master prompt&lt;/td&gt;
&lt;td&gt;What is true about the project: what it is, who it is for, constraints&lt;/td&gt;
&lt;td&gt;Rarely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scaffold files&lt;/td&gt;
&lt;td&gt;What has been decided and where the work stands&lt;/td&gt;
&lt;td&gt;Every session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session line&lt;/td&gt;
&lt;td&gt;What to do today&lt;/td&gt;
&lt;td&gt;Every session&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The master prompt is the stable background you paste or reference at the start. The session line is one sentence: the scope for today, plus "read &lt;code&gt;PROGRESS.md&lt;/code&gt; first". The middle layer is where most of the value is, so the rest of this article covers it.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;CLAUDE.md&lt;/code&gt;: thin, stable, surprising
&lt;/h2&gt;

&lt;p&gt;Claude Code reads &lt;code&gt;CLAUDE.md&lt;/code&gt; automatically at the start of a session, so every line in it is read every time. That is the reason to keep it short. Put in it only the conventions that differ from the agent's defaults.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Harbor Lane Tutoring
Marketing site and community bot for a one-person tutoring business.

## Commands
- Dev: `npm run dev`   Test: `npm test`   Lint: `npm run lint`

## Conventions that differ from defaults
- Public copy never promises grades, scores, or admissions.
- Price identifiers live in `config/prices.js`; never hard-code them.
- `src/lib/api-types.ts` is generated; never hand-edit it.

## Where state lives
- Status and next action: PROGRESS.md. Decisions: DECISIONS.md.

## Rules
- Plan, then wait for written approval, before touching payments or data.
- Never read or print .env* files. Reference secrets by variable name only.
- Run test and lint before declaring work done.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(Harbor Lane is a made-up example project.)&lt;/p&gt;

&lt;p&gt;Good entries are surprises: a generated file, an unusual tool, a rule about public copy. Bad entries restate defaults ("write clean code") or hold things that change ("we are working on the webhook"). If a line only repeats what the agent would do anyway, delete it. A rule of thumb is to stay around 40 lines.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;DECISIONS.md&lt;/code&gt;: decision, why, alternatives, revisit-if
&lt;/h2&gt;

&lt;p&gt;Every real decision gets a dated entry in a fixed format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### D-004: Map payments to roles through a config table
- Date: 2026-03-11
- Decision: Price identifiers map to tier roles in config/prices.js.
- Why: Prices will change; the logic should not.
- Alternatives considered: hard-coded if/else on amount (breaks when prices
  change); a database table (more machinery than three tiers justify).
- Revisit if: tiers exceed six, or non-developers need to edit them.
- Status: Active
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each field does a job:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Why&lt;/strong&gt; lets a future session judge edge cases instead of guessing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Alternatives considered&lt;/strong&gt; stops the same options being proposed again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Revisit if&lt;/strong&gt; names the evidence that would justify reopening the choice.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Never delete an entry. When you reverse a decision, add a new one that supersedes it and mark the old one &lt;code&gt;Superseded by D-NNN&lt;/code&gt;. The history is the point.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;PROGRESS.md&lt;/code&gt;: written for a session that remembers nothing
&lt;/h2&gt;

&lt;p&gt;This file answers three questions: where are we, what is blocked, what is next.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Status board
| Phase | State | Gate |
|---|---|---|
| 1. Website | In progress | npm test passes; pricing page renders |
| 2. Payment-to-access | Waiting on Phase 1 | Test-mode payment creates a role and channel |

## Next action
Wire the Standard tier payment link into the pricing card; run the render check.

## Blocked
- Live payment links: waiting on account verification.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three habits keep it useful:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;next action&lt;/strong&gt; is one concrete step, not a theme.&lt;/li&gt;
&lt;li&gt;A phase is &lt;strong&gt;done only when its gate passes&lt;/strong&gt;, not when the work feels finished.&lt;/li&gt;
&lt;li&gt;Update the file &lt;strong&gt;at the end of every session, before stopping&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  A gate for risky work: plan, approve, build
&lt;/h2&gt;

&lt;p&gt;For anything that touches money, customer data, going public, or deletion, split the work into three steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Plan.&lt;/strong&gt; The agent writes what it will do, in what order, what it will touch, and what could go wrong. It builds nothing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Approve.&lt;/strong&gt; You read the plan and reply in writing with what you approve and what you change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build.&lt;/strong&gt; The agent builds against the approved plan and reports any deviation.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Today: the payment webhook handler. Plan first. List the files you will touch,
the events you will handle, and the failure cases. Wait for my approval.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One detail matters here: an approval you gave in conversation does not exist for the next session. Record it in &lt;code&gt;PROGRESS.md&lt;/code&gt; ("Phase 2 webhook plan: approved 2026-03-12 with one change, 7-day activation expiry"). If it is not written down, treat it as not given. And approving a plan is not approving going live.&lt;/p&gt;

&lt;h2&gt;
  
  
  The open-and-close routine
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Open:&lt;/strong&gt; paste the master prompt, then add the session line (scope, "read &lt;code&gt;PROGRESS.md&lt;/code&gt; first", and the gate if there is one).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Close:&lt;/strong&gt; have the agent update &lt;code&gt;PROGRESS.md&lt;/code&gt; (status, next action, blockers). Any new decision gets a &lt;code&gt;DECISIONS.md&lt;/code&gt; entry. Ask it to state what it changed and what it did not verify.&lt;/p&gt;

&lt;p&gt;Reading is reliable; remembering is not. Five minutes of closing routine saves the time you would otherwise spend reconstructing context next time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it in 15 minutes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create &lt;code&gt;CLAUDE.md&lt;/code&gt; with your commands and only the conventions that surprise a newcomer.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;DECISIONS.md&lt;/code&gt; and write down the last three decisions you would hate to re-argue, with the reason for each.&lt;/li&gt;
&lt;li&gt;Create &lt;code&gt;PROGRESS.md&lt;/code&gt; with a status board, one next action, and a blocked list.&lt;/li&gt;
&lt;li&gt;Next session, start with: "Read &lt;code&gt;PROGRESS.md&lt;/code&gt; and &lt;code&gt;DECISIONS.md&lt;/code&gt; first, then do X."&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a decision keeps coming back, the entry is missing its "why" or its "revisit if". What does your agent keep reopening?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>claude</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
