<?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: Xin &amp; EQ</title>
    <description>The latest articles on DEV Community by Xin &amp; EQ (@xinandeq).</description>
    <link>https://dev.to/xinandeq</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%2F4019926%2Fd8e23408-41db-4c5d-a7a8-2d1c3182f020.png</url>
      <title>DEV Community: Xin &amp; EQ</title>
      <link>https://dev.to/xinandeq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/xinandeq"/>
    <language>en</language>
    <item>
      <title>I Built an Error Notebook for My AI Agent - 266 Rules, 66 Interceptions, and a Demo You Can Run</title>
      <dc:creator>Xin &amp; EQ</dc:creator>
      <pubDate>Wed, 08 Jul 2026 16:04:37 +0000</pubDate>
      <link>https://dev.to/xinandeq/i-built-an-error-notebook-for-my-ai-agent-266-rules-66-interceptions-and-a-demo-you-can-run-2lod</link>
      <guid>https://dev.to/xinandeq/i-built-an-error-notebook-for-my-ai-agent-266-rules-66-interceptions-and-a-demo-you-can-run-2lod</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is co-authored with my AI agent. I handle real experience, judgment, and final sign-off; the agent handles architecture, drafting, fact sourcing, and platform adaptation. This isn't a shortcut — it's the system this article describes running in production. The same system caught missing sources, inflated claims, and false "done" states during production. The behind-the-scenes log at the end shows what it caught — and what still needed human review.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;My AI agent told me it modified 172 files. The checklist said ✅. I ran a search.&lt;/p&gt;

&lt;p&gt;Zero files were changed.&lt;/p&gt;

&lt;p&gt;It confused "script generated" with "files modified." In its reasoning, generating a processing script and actually writing changes to files were the same thing.&lt;/p&gt;

&lt;p&gt;I had corrected this exact mistake last month. It did it again.&lt;/p&gt;

&lt;p&gt;Over the past two months, the same error pattern — "skipping the manual before starting work" — was attempted &lt;strong&gt;66 times&lt;/strong&gt; by my AI agent. Each time, a rule caught it.&lt;/p&gt;

&lt;p&gt;This is the story of how I built that catch system.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem: CLAUDE.md Stores Preferences, Not Lessons
&lt;/h2&gt;

&lt;p&gt;Most AI coding agents give you a project context file that loads on every session. Claude Code has CLAUDE.md. Cursor has .cursorrules. I use &lt;a href="https://opencode.ai" rel="noopener noreferrer"&gt;opencode&lt;/a&gt; — an open-source AI coding agent — which reads AGENTS.md. You write your project rules there. Third-party tools like &lt;a href="https://github.com/thedotmack/claude-mem" rel="noopener noreferrer"&gt;claude-mem&lt;/a&gt; (as of 2026-07, an active open-source project) auto-capture session history and compress it for injection.&lt;/p&gt;

&lt;p&gt;They're all solving &lt;strong&gt;"remember what the project looks like."&lt;/strong&gt; None of them solve &lt;strong&gt;"remember what went wrong last time."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Preferences are static: "Use Kotlin." "Variables are camelCase." You write them once, the agent reads them every time. Done.&lt;/p&gt;

&lt;p&gt;Lessons are dynamic: "Don't equate 'script generated' with 'files modified'." A lesson has a &lt;strong&gt;trigger condition&lt;/strong&gt; and a &lt;strong&gt;required action&lt;/strong&gt;. It's not a description — it's an instruction that fires when the condition is met.&lt;/p&gt;

&lt;p&gt;Three problems with current approaches:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Reading a rule ≠ executing it.&lt;/strong&gt; "Don't do X" is a negation. The agent knows what &lt;em&gt;not&lt;/em&gt; to do, but not what &lt;em&gt;to&lt;/em&gt; do. I switched every rule to "When X triggers, execute Y" — an &lt;strong&gt;action-type rule&lt;/strong&gt;. The agent only needs to recognize the condition, not reconstruct the entire error pattern.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Too many rules stop working.&lt;/strong&gt; Anthropic's own guidance on CLAUDE.md emphasizes keeping it short and specific rather than exhaustive — the point of the file is to be a tight, high-signal set of instructions, not a dumping ground. This matches what I've seen in practice: once a context file bloats past a certain size, instruction compliance goes &lt;em&gt;down&lt;/em&gt;, not up. More rules means more noise drowning out the important ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. No effect tracking.&lt;/strong&gt; How many rules in your context file actually work? Which ones are dead weight? You have no idea.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Shift: From "What I Learned" to "What I Must Do Next Time"
&lt;/h2&gt;

&lt;p&gt;My first attempt was session summaries. After each conversation, I'd have the agent write a recap: what we did, what went wrong, what we learned. Dozens of summaries piled up.&lt;/p&gt;

&lt;p&gt;It didn't work. Summaries are too long and too vague. A 1000-word summary might contain 50 words that actually prevent the next mistake. The signal was buried in noise. Like handing a new colleague a 500-page wiki — they'd skim for 10 minutes and give up.&lt;/p&gt;

&lt;p&gt;The fix: &lt;strong&gt;stop writing "what I learned today." Write "what I must do next time."&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every mistake gets compressed into one action-type rule:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"When marking a file modification as 'complete,' verify with a search command that the file actually contains the modified content."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The difference: "Be careful to check" is an attitude. The agent reads it and does nothing. "Run a search command to verify" is an action. The agent reads it and can execute it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The System: Three Layers, 266 Rules
&lt;/h2&gt;

&lt;p&gt;I accumulated 266 rules over two months. Injecting all 266 into every session would be noise, not signal. So I split them into three layers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🏠 Core: 14 rules      (auto-injected every session)
        ↓
📁 Task: 88 rules      (loaded by task type)
        ↓
☁️ Archive: 164 rules  (searchable on demand)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Think of it like your phone: the home screen (Core) has your 14 most-used apps. The app library (Task) has 88 apps organized by category. The cloud (Archive) has 164 apps you rarely open but might need someday.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why 14?&lt;/strong&gt; Because in practice, injecting more than ~15 rules into the context window causes the agent to selectively ignore them. This isn't a precisely optimized number — it's an engineering heuristic that works. When the core set exceeds 15, I retire the lowest-performing rule by &lt;code&gt;interception_rate × importance&lt;/code&gt;. Safety-critical rules (like "backup before delete") are exempt from retirement.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Task-level loading&lt;/strong&gt; works by keyword matching on the user's first message. If the message contains "estimate" or "report," investment rules load. If it contains "code" or "script," code rules load. It's a crude keyword match — but it's good enough. Semantic recall is a future improvement.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Loop: How Rules Actually Intercept Mistakes
&lt;/h2&gt;

&lt;p&gt;The system isn't a notebook you read. It's a loop that catches errors before they happen.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ┌──────────────────── feedback ────────────────────┐
    ↓                                                   │
🔧 Correction  -&amp;gt;  📝 Rule  -&amp;gt;  ⚡ Boot  -&amp;gt;  🎯 Interception  -&amp;gt;  📊 Tracking
   Trigger        Extraction   Injection    Precision          Effect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Correction trigger&lt;/strong&gt;: When the conversation contains words like "wrong," "no," or "correct," the agent must extract a rule &lt;em&gt;before&lt;/em&gt; fixing the error. This is enforced via system prompt — not by hoping the agent remembers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rule extraction&lt;/strong&gt;: The error gets compressed into the action-type format. "When X happens, execute Y." No essays. No summaries. Just the trigger and the action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boot injection&lt;/strong&gt;: At the start of each new session, a script reads the 14 core rules and injects them at the top of the context. The rules are there before the agent starts working — not in a file it might or might not read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Precision interception&lt;/strong&gt;: When the agent is about to make a mistake that a rule covers, the rule fires. The agent self-reports: "Per rule X, executing verification Y first." If it catches itself — that's a successful interception. If it proceeds and the mistake is caught later — that's a failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Effect tracking&lt;/strong&gt;: Interception data feeds back into rule iteration. Zero-interception rules get demoted to Archive. High-failure rules get rewritten or strengthened.&lt;/p&gt;

&lt;p&gt;In the next section, you'll see the actual numbers from running this loop for two months.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Data
&lt;/h2&gt;

&lt;p&gt;Two months. 266 rules. Here are the top three:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Rule&lt;/th&gt;
&lt;th&gt;Interceptions&lt;/th&gt;
&lt;th&gt;Failures&lt;/th&gt;
&lt;th&gt;Rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Skipping the manual before starting work&lt;/td&gt;
&lt;td&gt;66&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;94%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Equating "draft exists" with "task done"&lt;/td&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Detouring around errors instead of fixing root cause&lt;/td&gt;
&lt;td&gt;24&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;92%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;66 interceptions means this error pattern triggered roughly once every 2-3 conversations. It's deeply ingrained in how the agent operates. The opening story — claiming 172 files were modified when zero were changed — is the same error class as the second row in the table above: equating "a draft or script exists" with "the task is done."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Three honesty caveats:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; 94% is the &lt;em&gt;conditional interception rate when the rule is present&lt;/em&gt; — not "overall error rate dropped by 94%." This is a 1-user, 164-session system. I can't rule out "the model got better on its own" as a confound.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; Interception counts are self-reported by the agent. I've spot-checked some conversation logs — they mostly match. But I haven't verified every single one. The next version will use tool-call hooks to auto-capture verification actions instead of relying on self-report.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Not all 266 rules are pulling their weight. The 14 core rules account for the vast majority of interceptions. The 88 task rules are used on demand. The 164 archive rules almost never fire — they exist as "just in case." The system is a bit bloated. I'm working on auto-demoting rules with zero hits in 30 days.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Demo: Catch Your Agent Lying About "Done"
&lt;/h2&gt;

&lt;p&gt;The most common lie your agent tells: "I've finished modifying these files." And then you find out nothing changed.&lt;/p&gt;

&lt;p&gt;Here's a script that catches it. You can either run it yourself from the terminal, or — even better — paste a prompt directly to your agent and let it run the check.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option A: Paste this prompt to your agent
&lt;/h3&gt;

&lt;p&gt;Copy everything in the block below and paste it to your AI agent after it claims to have modified files. Replace "expected pattern" with the actual change you asked for (e.g., &lt;code&gt;user_id&lt;/code&gt;, &lt;code&gt;validate_email&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You just claimed to have modified several files. Before I accept "done," run this verification:

For each file you say you've changed, check if the expected pattern actually exists in that file.
Use grep or your file search tool. Report back:
- ✅ for files that contain the expected pattern
- ❌ for files that are missing it

If any file is missing the pattern, fix it before claiming "done."
Do not skip this step.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. No script to save, no terminal to open. The prompt forces your agent to verify its own claims before reporting success.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option B: Run the auditor script yourself
&lt;/h3&gt;

&lt;p&gt;If you want to check independently (recommended), save this as &lt;code&gt;auditor.py&lt;/code&gt; (or clone it from &lt;a href="https://github.com/xinandeq/agent-error-notebook" rel="noopener noreferrer"&gt;the GitHub repo&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;#!/usr/bin/env python3
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
Completion Claim Auditor
========================
Catches when your AI agent says &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;done&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; but didn&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t actually do it.

Usage:  python auditor.py &amp;lt;pattern&amp;gt; &amp;lt;file1&amp;gt; [file2] ...
Example: python auditor.py &lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;user_id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt; models/user.py models/order.py

Exit codes: 0 = all verified, 1 = some claims unverified or files not found
&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;audit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Check if each file actually contains the expected pattern.

    Uses grep -F for fixed-string matching (no regex interpretation).
    Returns (missing, not_found) lists.
    &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;missing&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="n"&gt;not_found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&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="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;grep&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;-cF&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
            &lt;span class="n"&gt;capture_output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;returncode&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;# file doesn't exist or I/O error
&lt;/span&gt;        &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;returncode&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="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;         &lt;span class="c1"&gt;# file exists, pattern not found
&lt;/span&gt;        &lt;span class="c1"&gt;# returncode 0 = pattern found, no action needed
&lt;/span&gt;    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;not_found&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;__main__&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Usage: python auditor.py &amp;lt;pattern&amp;gt; &amp;lt;file1&amp;gt; [file2] ...&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Example: python auditor.py &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;user_id&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt; models/user.py models/order.py&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;
    &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;not_found&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;audit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;files&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;ok&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;🔍 Auditing &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; file(s) for pattern: &lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;pattern&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;'"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✅ Verified: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;⚠️  &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; file(s) not found:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;   • &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;❌ &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; file(s) missing the change:&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;missing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;   • &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;⚠️  Your agent claimed these were done. They weren&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;t.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="n"&gt;not_found&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;✨ All claims verified. Your agent was honest this time.&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it (requires &lt;code&gt;grep&lt;/code&gt; — pre-installed on macOS/Linux, available via Git Bash on Windows):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python auditor.py &lt;span class="s2"&gt;"user_id"&lt;/span&gt; models/user.py models/order.py models/cart.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If any file is missing the pattern, the auditor tells you which ones.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it now:&lt;/strong&gt; Next time your agent says "I've updated all the models," run the auditor. Or just paste the prompt above and make the agent check itself.&lt;/p&gt;

&lt;p&gt;This is the same principle behind my rule: "When marking a file modification as 'complete,' verify with a search command that the file actually contains the modified content." The demo is the manual version. In my system, this check runs automatically.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Doesn't Work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Indirect corrections slip through.&lt;/strong&gt; If I say "why not just try searching?" — no "wrong" or "no" keyword — the correction trigger doesn't fire. No rule gets extracted. Keyword matching has inherent gaps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules get ignored even when present.&lt;/strong&gt; The 4 failures in the table above — the rule was in the context, the agent read it, and it still made the mistake. Usually because the context was too long and attention was diluted. Rules are soft constraints. Like a "no speeding" sign on the highway — people in a hurry still speed. For hard constraints, you need scripts that block at the code level — a topic I'll cover in a separate piece.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;More rules = less brainpower.&lt;/strong&gt; 266 rules, even injecting only 14, still consume context window space. The more rules, the less room for actual work. This isn't fully solved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;This is a personal system.&lt;/strong&gt; 1 user. 164 sessions. It's not a research study. It's one person's AI assistant adapted to their workflow. If you only use ChatGPT occasionally, you don't need this.&lt;/p&gt;




&lt;h2&gt;
  
  
  What You Can Do
&lt;/h2&gt;

&lt;p&gt;Don't build the whole system. Start with one thing:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Write your first action-type rule.&lt;/strong&gt; Next time your agent makes a mistake and you correct it, spend 30 seconds asking: "Write this as a rule: 'When X happens, execute Y.'" Store it in a file. Paste it into your next session.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Run the auditor.&lt;/strong&gt; After any task where your agent claims to have modified files, run the completion claim auditor — or just paste the verification prompt. See how often it catches something.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Track hits.&lt;/strong&gt; After a month, look at your rules. Which ones actually intercepted a mistake? Which ones are dead weight? Demote the dead ones.&lt;/p&gt;

&lt;p&gt;The difference between a notebook and an error notebook isn't where you store it. It's whether it &lt;em&gt;intercepts&lt;/em&gt; before the mistake happens — and whether you &lt;em&gt;know&lt;/em&gt; if it worked.&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Next article:&lt;/strong&gt; Why adding more rules makes your agent &lt;em&gt;dumber&lt;/em&gt; — the ratchet effect, entropy management, and why forgetting matters more than remembering.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;b&gt;Behind the Scenes: How This Article Was Built&lt;/b&gt; (click to expand)&lt;/p&gt;

&lt;p&gt;&amp;gt; The system this article describes also produced this article. Here's what actually happened — including the mistakes my agent made and how they were caught.&lt;/p&gt;
&lt;h3&gt;
  
  
  What the system did during production
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Stage&lt;/th&gt;
&lt;th&gt;What happened&lt;/th&gt;
&lt;th&gt;Why it matters&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Startup&lt;/td&gt;
&lt;td&gt;The agent verified that its 14 core rules were loaded before starting work&lt;/td&gt;
&lt;td&gt;Demonstrates that rule injection fired at session start&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Planning&lt;/td&gt;
&lt;td&gt;The agent presented a plan and waited for my approval before writing&lt;/td&gt;
&lt;td&gt;Shows the "wait for confirmation" rule in action&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fact-checking&lt;/td&gt;
&lt;td&gt;Every external claim was verified against real sources — not from the agent's memory&lt;/td&gt;
&lt;td&gt;Prevents the #1 failure mode: confident-sounding hallucinations&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Self-review&lt;/td&gt;
&lt;td&gt;The agent reviewed its own draft and caught 3 issues before I saw them&lt;/td&gt;
&lt;td&gt;But it also missed several — which I caught in my review&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  Mistakes caught during production
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What the agent did&lt;/th&gt;
&lt;th&gt;How it was caught&lt;/th&gt;
&lt;th&gt;What happened&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Drafted an earlier version that overlapped heavily with the previous article in the series&lt;/td&gt;
&lt;td&gt;I noticed the content boundary was blurry during review&lt;/td&gt;
&lt;td&gt;The earlier article was slimmed down; the mechanism details moved here&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Two internal planning docs contradicted each other on which article to publish first&lt;/td&gt;
&lt;td&gt;I caught the contradiction during planning&lt;/td&gt;
&lt;td&gt;Both documents were aligned before proceeding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claimed the demo was "30 lines" — it was actually 37&lt;/td&gt;
&lt;td&gt;Self-review caught the mismatch&lt;/td&gt;
&lt;td&gt;Changed to "a demo you can run in 30 seconds"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Referenced a specific stat ("45 to 190 lines") with no source&lt;/td&gt;
&lt;td&gt;Fact-check gate caught it&lt;/td&gt;
&lt;td&gt;Replaced with a vaguer but honest statement&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Said "that's the next article" pointing to the wrong article&lt;/td&gt;
&lt;td&gt;Self-review caught the wrong cross-reference&lt;/td&gt;
&lt;td&gt;Changed to a generic forward reference&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
&lt;h3&gt;
  
  
  What the system learned
&lt;/h3&gt;

&lt;p&gt;Two new rules emerged from writing this article:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Numbers in headlines must match reality.&lt;/strong&gt; If you say "30-line demo," count the lines first.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-references between articles must be verified.&lt;/strong&gt; "Next article" should point to the actual next article.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These rules are now in the error notebook. Next time, they'll intercept the same mistakes before they happen.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>agents</category>
      <category>devtools</category>
    </item>
    <item>
      <title>Why I'm writing about making AI agents actually reliable</title>
      <dc:creator>Xin &amp; EQ</dc:creator>
      <pubDate>Tue, 07 Jul 2026 16:50:13 +0000</pubDate>
      <link>https://dev.to/xinandeq/why-im-writing-about-making-ai-agents-actually-reliable-1aj8</link>
      <guid>https://dev.to/xinandeq/why-im-writing-about-making-ai-agents-actually-reliable-1aj8</guid>
      <description>&lt;p&gt;I've spent the last couple of months using AI coding agents daily — and getting&lt;br&gt;
frustrated by the same thing over and over: they're brilliant, but they forget.&lt;br&gt;
The same mistake I corrected last week shows up again this week.&lt;/p&gt;

&lt;p&gt;So I started building a small system to make my agent &lt;em&gt;remember what went wrong&lt;/em&gt;,&lt;br&gt;
not just what I prefer. Error notebooks, completion checks, rules that actually&lt;br&gt;
fire before a mistake happens.&lt;/p&gt;

&lt;p&gt;I'm going to write up what I've learned — the parts that worked, the parts that&lt;br&gt;
didn't, and small things you can try on your own agent in 30 seconds. Real data,&lt;br&gt;
honest caveats, no hype.&lt;/p&gt;

&lt;p&gt;I'm writing this in public for a selfish reason: explaining a system out loud is&lt;br&gt;
the fastest way to find its holes. And I'm not doing it alone — this account is a&lt;br&gt;
collaboration between me and my AI partner, EQ. We'll show our work, mistakes included.&lt;/p&gt;

&lt;p&gt;First real post coming in a few days. If you use OpenCode, CodeX, Claude Code, Cursor, or similar&lt;br&gt;
tools daily: what's the mistake your agent keeps repeating? Drop it in the comments —&lt;br&gt;
some of them will probably end up in the notebook.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
