<?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: ZTW</title>
    <description>The latest articles on DEV Community by ZTW (@won_ztw).</description>
    <link>https://dev.to/won_ztw</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%2F4105776%2F771acd67-c58c-4c33-8451-4f9f23c417ac.jpg</url>
      <title>DEV Community: ZTW</title>
      <link>https://dev.to/won_ztw</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/won_ztw"/>
    <language>en</language>
    <item>
      <title>The Three-File System That Fixed Claude Code's Amnesia Across 11 Projects</title>
      <dc:creator>ZTW</dc:creator>
      <pubDate>Wed, 02 Sep 2026 08:58:25 +0000</pubDate>
      <link>https://dev.to/won_ztw/the-three-file-system-that-fixed-claude-codes-amnesia-across-11-projects-23ga</link>
      <guid>https://dev.to/won_ztw/the-three-file-system-that-fixed-claude-codes-amnesia-across-11-projects-23ga</guid>
      <description>&lt;p&gt;I run Claude Code across eleven projects at the same time.&lt;/p&gt;

&lt;p&gt;Not eleven files. Eleven separate products, each with its own stack, its own history, and its own set of decisions I made months ago and no longer remember making.&lt;/p&gt;

&lt;p&gt;At one project, session amnesia is a papercut. At eleven, it &lt;em&gt;is&lt;/em&gt; the job.&lt;/p&gt;

&lt;p&gt;This is the structure that finally fixed it. No prompt engineering, no clever wording — just files, and hooks that enforce them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem isn't that CLAUDE.md doesn't work
&lt;/h2&gt;

&lt;p&gt;It works fine. That's what makes the failure so slow to notice.&lt;/p&gt;

&lt;p&gt;You write a good &lt;code&gt;CLAUDE.md&lt;/code&gt;. The agent reads it. Things improve. So when a new problem appears, you add a section. Then another. Six weeks later the file is 400 lines, half of it is stale project state, and the agent is quietly ignoring the middle of it because the rules are buried under a changelog.&lt;/p&gt;

&lt;p&gt;The mistake isn't the length. &lt;strong&gt;The mistake is that you put three different kinds of information in one file, and they change at completely different rates.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Split by rate of change, not by topic
&lt;/h2&gt;

&lt;p&gt;Here's the split that fixed it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;File&lt;/th&gt;
&lt;th&gt;Changes&lt;/th&gt;
&lt;th&gt;Compressed?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Law&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Rarely, deliberately&lt;/td&gt;
&lt;td&gt;Never&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;State&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;PROGRESS.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Every work turn&lt;/td&gt;
&lt;td&gt;After 24h&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Wisdom&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LESSONS.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;When you correct the agent&lt;/td&gt;
&lt;td&gt;Never&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Law&lt;/strong&gt; is rules. "Always show physical evidence before claiming success." "Never edit &lt;code&gt;.env&lt;/code&gt;." These change maybe once a month, when you decide they change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;State&lt;/strong&gt; is where the project is right now. Current phase, what's in flight, what's verified, what's broken. This churns constantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wisdom&lt;/strong&gt; is what you learned the hard way. Corrections you issued. Traps that cost you an afternoon. This only ever grows.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why the separation is the whole trick
&lt;/h3&gt;

&lt;p&gt;Because compression has to happen, and it has to happen selectively.&lt;/p&gt;

&lt;p&gt;State churns daily. If you never compress it, every session start re-reads weeks of narrative you'll never need again, and you pay tokens for it on every single project, every single day.&lt;/p&gt;

&lt;p&gt;Wisdom is permanent. Compressing it destroys the exact thing you kept it for — a lesson summarized into a hint stops being a lesson.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Put them in one file and there is no setting that works.&lt;/strong&gt; Compress aggressively and you shred your hard-won lessons. Don't compress and you bleed tokens forever. The only way out is to stop asking one file to do both jobs.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule with the best cost-to-value ratio
&lt;/h2&gt;

&lt;p&gt;At the start of every session, before anything else:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Read &lt;code&gt;PROGRESS.md&lt;/code&gt; and open with exactly three lines: current phase, what was in progress, what's next.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it. Roughly 50 tokens.&lt;/p&gt;

&lt;p&gt;It removed more daily friction than anything else I did. Instead of "what were we doing?" followed by three minutes of re-explaining, the session opens with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Phase: auth rewrite
2. In progress: token refresh, 2 tests still red
3. Next: fix the expiry edge case, then ship
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent knows. You didn't have to tell it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't ask the agent nicely. Use hooks.
&lt;/h2&gt;

&lt;p&gt;This is where most CLAUDE.md setups stop, and it's why they drift.&lt;/p&gt;

&lt;p&gt;A rule in a markdown file is a &lt;em&gt;request&lt;/em&gt;. The agent usually honors it. Usually is doing a lot of work in that sentence.&lt;/p&gt;

&lt;p&gt;Two things I moved from request to enforcement:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Secret files.&lt;/strong&gt; Instead of "please don't edit &lt;code&gt;.env&lt;/code&gt;", a &lt;code&gt;PreToolUse&lt;/code&gt; hook that denies the write outright:&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="n"&gt;BLOCKED_PATTERNS&lt;/span&gt; &lt;span class="o"&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;.env&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;.env.*&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;*credential*.json&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;client_secret*&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;*.pem&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;*.key&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;id_rsa*&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_blocked&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;basename&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;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fnmatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;basename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&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;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;ALLOWED_PATTERNS&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;any&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;fnmatch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;basename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&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;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;BLOCKED_PATTERNS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent is good at deciding what code should say. It's bad at deciding what a secret file should say. So I removed the decision entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Tests on save.&lt;/strong&gt; A &lt;code&gt;PostToolUse&lt;/code&gt; hook that runs the test suite the instant code changes and feeds failures straight back to the agent. Self-review doesn't catch what an adversarial step catches.&lt;/p&gt;

&lt;p&gt;One detail that cost me an afternoon: &lt;strong&gt;run the test command from the project root, not from the edited file's directory.&lt;/strong&gt; Projects with &lt;code&gt;tests/&lt;/code&gt; separate from &lt;code&gt;src/&lt;/code&gt; report "0 tests collected" when the runner starts in the wrong place — and a green zero looks exactly like a pass.&lt;/p&gt;

&lt;h2&gt;
  
  
  The failure that took longest to notice
&lt;/h2&gt;

&lt;p&gt;This one is worth the whole post.&lt;/p&gt;

&lt;p&gt;The agent would diligently update the local progress file, and silently skip the shared knowledge log.&lt;/p&gt;

&lt;p&gt;Nothing errors. Nothing looks wrong. You find out weeks later, when you go looking for an answer that should be there and isn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Silent gaps are worse than loud failures.&lt;/strong&gt; A loud failure interrupts you. A silent gap accumulates.&lt;/p&gt;

&lt;p&gt;The fix is to treat the two writes as one action, with an explicit self-check before the agent reports anything: &lt;em&gt;did both get written?&lt;/em&gt; If either is missing, write it before reporting.&lt;/p&gt;

&lt;h2&gt;
  
  
  What breaks first, in order
&lt;/h2&gt;

&lt;p&gt;If you're scaling up, this is the order the failures arrive:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Session amnesia&lt;/strong&gt; (project 1) → wake-up briefing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-project blindness&lt;/strong&gt; (project 3) → a registry the agent can read&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Repeated mistakes&lt;/strong&gt; (project 4) → a lessons file separate from state&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Token bleed&lt;/strong&gt; (project 8) → compression discipline&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent write gaps&lt;/strong&gt; (project 10) → same-turn write pairing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You don't need to solve five before you have one. But knowing the order means you recognize each failure when it shows up, instead of concluding the whole approach doesn't work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try the ideas free
&lt;/h2&gt;

&lt;p&gt;Everything above is structural — you can build it yourself in an afternoon with the table and the two hook snippets. That's genuinely the point of the post.&lt;/p&gt;

&lt;p&gt;If you'd rather not spend the afternoon, I packaged the whole thing: four document templates, both hooks, a scaffolding script that lays down a project's doc kit in one command, a registry audit script, and the twelve rules each written next to the specific failure that produced it.&lt;/p&gt;

&lt;p&gt;Every script ships with a &lt;code&gt;--demo&lt;/code&gt; self-check so you can verify it before trusting it with your repo:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="gp"&gt;$&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;python hooks/guard_secrets.py &lt;span class="nt"&gt;--demo&lt;/span&gt;
&lt;span class="go"&gt;guard_secrets: all checks passed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you just want the structure, the three templates are free and MIT-licensed:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/wondi81/agent-os-lite" rel="noopener noreferrer"&gt;github.com/wondi81/agent-os-lite&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's the part you should have for nothing — you can rebuild it yourself in an&lt;br&gt;
afternoon once you've seen the shape, so there's no reason to charge for it. What&lt;br&gt;
it doesn't do is enforce anything; markdown asks nicely and an agent can talk&lt;br&gt;
itself out of a request.&lt;/p&gt;

&lt;p&gt;The full version is where the hooks live, plus the scaffolding and the registry&lt;br&gt;
audit:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://wondigo.gumroad.com/l/fnpexn" rel="noopener noreferrer"&gt;Agent OS — $29&lt;/a&gt;&lt;/strong&gt; · zero dependencies, 30-day refund.&lt;/p&gt;




&lt;p&gt;If you're running Claude Code across multiple projects, I'd genuinely like to hear which of the five failures hit you first. My guess is #3 catches more people than they realize.&lt;/p&gt;

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