<?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: Alfredo Izquierdo</title>
    <description>The latest articles on DEV Community by Alfredo Izquierdo (@alfredoizjr).</description>
    <link>https://dev.to/alfredoizjr</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%2F3802145%2F4a4bb8e3-6da9-49bc-899b-4699d1d31481.jpg</url>
      <title>DEV Community: Alfredo Izquierdo</title>
      <link>https://dev.to/alfredoizjr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alfredoizjr"/>
    <language>en</language>
    <item>
      <title>Can You Detect Contradictions in AI Agent Memory? I Measured It</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Thu, 19 Nov 2026 19:33:50 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/can-you-detect-contradictions-in-ai-agent-memory-i-measured-it-32n9</link>
      <guid>https://dev.to/alfredoizjr/can-you-detect-contradictions-in-ai-agent-memory-i-measured-it-32n9</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/detect-contradictions-in-ai-agent-memory" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I wanted to detect contradictions in AI agent memory automatically: the moment you save "drop Redis, sessions go in Postgres", the tool should notice you once saved "use Redis for sessions" and tap you on the shoulder. I spent a day building it, ran it on 193 of my own real memories, and the numbers told me to stop. This is that day, with the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I wanted it
&lt;/h2&gt;

&lt;p&gt;The same morning, my blog pipeline wrote a post I had already thrown away four days earlier. I had saved the fix. But months before, I had saved another note saying the workflow reads its config from somewhere else entirely, so the fix went into a file nothing reads. Two true notes, nothing connecting them.&lt;/p&gt;

&lt;p&gt;I posted about it on r/ClaudeCode and the thread filled up with people solving the same problem by hand. One runs a hook that checks for contradictions every time memory or &lt;code&gt;CLAUDE.md&lt;/code&gt; is edited. One keeps one fact per file and overwrites in place, with git holding the history. One uses architecture decision records and marks the old one "Superseded by ADR-012". Everyone had the same rule underneath: when a decision changes, deal with the old note in the same step.&lt;/p&gt;

&lt;p&gt;So the feature wrote itself in my head. On every save, look for older memories that resemble the new one. If something is close, warn: "this looks like X, do you want to update it or link them?" Never block, never decide on its own. Just make it impossible to miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;ContextForge already turns every memory into an embedding for search, so the cheap version was obvious. When a memory is saved, compare its embedding with the others in the same project, and return the closest ones above a threshold. If you've used semantic search, you know the move.&lt;/p&gt;

&lt;p&gt;I was careful about the boring parts, because this runs on every save of a product people use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It only compares inside the same project and the same organization. A test checks that an identical note in someone else's account never shows up.&lt;/li&gt;
&lt;li&gt;If anything in the lookup fails, the save still goes through. The warning is optional; the memory isn't.&lt;/li&gt;
&lt;li&gt;Installed clients that don't ask for it see exactly the same response as before.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All of that worked. Locally, two near-identical notes scored 0.95, unrelated notes stayed below 0.69, and I had a placeholder threshold of 0.80 that looked comfortable.&lt;/p&gt;

&lt;p&gt;Then I did the part I almost skipped: before shipping, measure it on real data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The test
&lt;/h2&gt;

&lt;p&gt;I wrote a read-only script and ran it against my own project: 193 memories about building ContextForge. It does two things.&lt;/p&gt;

&lt;p&gt;First, it scores a known pair that &lt;strong&gt;should&lt;/strong&gt; trigger the warning. I used a clean one: a note explaining why my n8n cron misfired (Docker's VM sleeps when the Mac sleeps) and the later note saying the fix was applied (launchd now triggers it). Cause and fix. Exactly the kind of pair you want linked.&lt;/p&gt;

&lt;p&gt;Second, it measures noise the way a user would feel it: for every memory, pretend you're saving it now and check whether anything else in the project would cross the threshold. That gives you "what percentage of saves would show a warning". My goal was 5% or less. Anything more and people learn to ignore it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The numbers
&lt;/h2&gt;

&lt;p&gt;Whole-memory embeddings first:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Threshold&lt;/th&gt;
&lt;th&gt;Catches the cause → fix pair?&lt;/th&gt;
&lt;th&gt;Saves that would warn&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;0.70&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;79%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.75&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;td&gt;62%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.80&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;40%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.85&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;17%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;0.90&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;2%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pair scored 0.773. To catch it, the tool would nag on six saves out of ten. At 0.90 the noise is fine, but by then it only catches near copies, which isn't the problem anyone in that thread had.&lt;/p&gt;

&lt;p&gt;I suspected the culprit was length: long notes in one project share a topic, so their embeddings mostly say "this is about n8n". So I tried shorter inputs.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;What I compared&lt;/th&gt;
&lt;th&gt;Pair score&lt;/th&gt;
&lt;th&gt;Best threshold that still catches it&lt;/th&gt;
&lt;th&gt;Saves that would warn&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Whole memory&lt;/td&gt;
&lt;td&gt;0.773&lt;/td&gt;
&lt;td&gt;0.75&lt;/td&gt;
&lt;td&gt;62%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title only&lt;/td&gt;
&lt;td&gt;0.579&lt;/td&gt;
&lt;td&gt;never caught&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title + first paragraph&lt;/td&gt;
&lt;td&gt;0.802&lt;/td&gt;
&lt;td&gt;0.80&lt;/td&gt;
&lt;td&gt;19%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shared words in the title&lt;/td&gt;
&lt;td&gt;0.061&lt;/td&gt;
&lt;td&gt;never caught&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Title plus the first paragraph was the best, and it still warns on one save in five.&lt;/p&gt;

&lt;p&gt;One honest caveat: a single positive pair is thin evidence for where the threshold should sit. But the noise column doesn't depend on that pair at all. Whatever threshold you pick low enough to catch a real "this replaces that", a large share of normal saves cross it too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it fails
&lt;/h2&gt;

&lt;p&gt;Similarity measures topic. "This decision replaces that one" is not a topic.&lt;/p&gt;

&lt;p&gt;In a real project, most of your notes cluster around the same few subjects. My n8n notes look like each other because they are all about n8n. The note that matters, the one that silently overrides another, doesn't look more similar than its neighbours. It looks exactly as similar as everything else in the cluster. You can't find a needle by measuring how much it resembles hay when the needle is made of hay.&lt;/p&gt;

&lt;p&gt;There was a second, smaller lesson: speed. Pulling every embedding in the project into the function took about 1.1 seconds per save on 193 memories. If this ever comes back, the scoring has to happen inside the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  What works instead (today)
&lt;/h2&gt;

&lt;p&gt;None of this means the problem is hopeless. It means the fix isn't a threshold.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deal with the old note when you write the new one.&lt;/strong&gt; Overwrite it, delete it, or mark it replaced. Every experienced person in that thread does this, and it costs one sentence to your agent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make the replacement explicit.&lt;/strong&gt; In ContextForge that's a &lt;code&gt;supersedes&lt;/code&gt; link between the two memories; in an ADR folder it's "Superseded by ADR-012". Search then pulls in the new one next to the old one. I wrote about &lt;a href="https://contextforge.dev/blog/knowledge-graph-memory-for-ai-coding-assistants" rel="noopener noreferrer"&gt;how those links work&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put hard rules where they're enforced, not remembered.&lt;/strong&gt; A hook or a check that fails beats a note in memory for anything that really can't drift. My n8n bug came back precisely because the only guard was a note.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What I'll try next
&lt;/h2&gt;

&lt;p&gt;If a tool is going to spot contradictions, it has to understand the two notes, not measure their distance. The design I'd try is: use similarity only to shortlist a few candidates, then ask a small model "does the new note replace, contradict or duplicate this one?", and do it in the background instead of on the save, surfacing the result the next time your agent loads context. It costs more, and I'll measure it the same way before anyone sees it.&lt;/p&gt;

&lt;p&gt;The warning I built that day is parked. It never shipped. The script that stopped it is the most useful thing I wrote all week.&lt;/p&gt;

&lt;p&gt;If you've found a way to catch a reversed decision automatically, I'd love to hear how you measured it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>claudecode</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Stop Claude Code From Following Outdated Decisions</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Wed, 18 Nov 2026 14:44:54 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/how-to-stop-claude-code-from-following-outdated-decisions-p8f</link>
      <guid>https://dev.to/alfredoizjr/how-to-stop-claude-code-from-following-outdated-decisions-p8f</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/stop-claude-code-from-following-outdated-decisions" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I spent this week trying to stop Claude Code from following outdated decisions, and the first thing I learned is that the agent wasn't the problem. I was.&lt;/p&gt;

&lt;p&gt;Here's what happened. I have a small workflow that drafts blog posts for me twice a week. Last Friday I told it to stop writing about one topic, saved the fix, and moved on. On Tuesday it wrote that exact post again. The fix was real. It just lived in a JSON file the workflow had stopped reading weeks earlier, and I had a note from September saying exactly that. Two true notes, saved months apart, and nothing connecting them. The old JSON file was still sitting in the repo looking completely official.&lt;/p&gt;

&lt;p&gt;So I did what I should have done earlier and asked on r/ClaudeCode: how do you stop Claude Code from following a decision you already reversed? About a dozen people answered, some of them with setups far more careful than mine. This post is what they told me, plus the parts that, by their own admission, don't really work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the old decision keeps winning
&lt;/h2&gt;

&lt;p&gt;Someone in the thread summed up the mechanism in one line, and it changed how I think about this: an old note doesn't lose just because a newer one exists. It loses only when the correction travels with it. Mine never did. When Claude Code looks for context, it takes whatever matches the question best. The old decision usually matches &lt;em&gt;better&lt;/em&gt;. It was written when the topic was fresh, so it's longer and more detailed. Your correction is one line typed in a hurry. And if both show up at once, nothing says which one is current. "Use Redis for sessions" and "drop Redis, sessions go in Postgres" are both confident. The agent picks one.&lt;/p&gt;

&lt;p&gt;I wrote earlier about the opposite failure, &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;when a decision never reaches the session at all&lt;/a&gt;. This is the other half: it arrives, and it's the old one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What people actually do
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Fix it where the agent will look anyway
&lt;/h3&gt;

&lt;p&gt;The most practical answer I got was also the most obvious, and I'd missed it completely: deal with the stale file itself. If nothing uses it anymore, remove it. If it has to stay, say so at the top of the file, in plain words, that it's no longer what the workflow runs on.&lt;/p&gt;

&lt;p&gt;The argument behind it is what convinced me. My agent was going to open that file regardless of what my memory search returned. A warning in a separate note might or might not show up. A warning inside the file shows up every single time someone opens it, human or agent.&lt;/p&gt;

&lt;h3&gt;
  
  
  Give every fact one home, and edit it there
&lt;/h3&gt;

&lt;p&gt;The most common setup: one fact per file. Before saving anything new, the agent checks whether a file already covers it, and updates that one instead of creating a duplicate. If the old fact turned out to be wrong, it gets deleted. History lives in git, or in a monthly archive the agent never reads.&lt;/p&gt;

&lt;p&gt;One person added a clever guard on top: an automated check before pushing that complains when docs start collecting dated "we changed this on…" lines. Those notes are how a file turns into a timeline of old decisions, and the check stops it before it starts.&lt;/p&gt;

&lt;p&gt;Where it breaks: the agent doesn't always do the "check first" part, especially deep into a long session. And the moment a fact has leaked into three places, editing one leaves the other two voting for the old version.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mark the old one as replaced instead of deleting it
&lt;/h3&gt;

&lt;p&gt;Someone working on a very large codebase described a layout I'm now a little jealous of. Roughly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE.md&lt;/code&gt; is only about &lt;em&gt;how&lt;/em&gt; to work in the repo. No facts in it.&lt;/li&gt;
&lt;li&gt;One folder describes how each part of the system works today, and points to the code and the decisions behind it.&lt;/li&gt;
&lt;li&gt;One folder holds the decisions themselves, as architecture decision records (ADRs). A decision that changes isn't removed; it's marked as replaced, with a pointer to the decision that replaced it.&lt;/li&gt;
&lt;li&gt;One folder is the agent's scratchpad for work in progress.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I like the "replaced by" pointer because it keeps the &lt;em&gt;why&lt;/em&gt; of the old decision, which is exactly what stops someone from proposing it again next month. In a memory tool the same idea is a link between the two notes saying "this one replaces that one". I wrote about &lt;a href="https://contextforge.dev/blog/knowledge-graph-memory-for-ai-coding-assistants" rel="noopener noreferrer"&gt;how those links work&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Where it breaks: someone has to write that line. Forget it once and you're back to two confident records.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keep the current rules in one place, and treat logs as history only
&lt;/h3&gt;

&lt;p&gt;The most honest reply in the thread came from someone who went back through a month of their own sessions to see what was going on. What they found was a collection of small contradictions, each one harmless alone. One file claimed a safety check was disabled while the project settings still ran it. Two copies of the same instruction file had drifted apart. And they'd given the agent opposite instructions about asking for permission at two different times. Both were still lying around, so the agent simply obeyed whichever one it came across first.&lt;/p&gt;

&lt;p&gt;Their fix was structural. The rules that must hold now sit in a single file that gets read at the start of every session. Session logs are only ever added to, and the agent is instructed not to treat them as instructions, so an old decision buried in a log can't resurface as an order. And instead of letting the agent pull from its built-in memory, they make it go through their notes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use a check, not a sentence
&lt;/h3&gt;

&lt;p&gt;Two people arrived at the same idea from different directions. One reminded me that an instruction is only ever a request to the model; anything that truly must not drift needs something in code that enforces it. The other runs a small hook that asks a model to look for contradictions every time an instruction or memory file changes, plus a tool that flags instructions overlapping each other, since overlaps are where conflicts tend to hide.&lt;/p&gt;

&lt;p&gt;My own bug fits this perfectly. The only thing protecting "don't write this topic again" was a note, and a note can be overruled by another note. A failing check can't.&lt;/p&gt;

&lt;h3&gt;
  
  
  When it breaks anyway, clean up properly
&lt;/h3&gt;

&lt;p&gt;One developer treats every one of these as a small incident. First they get Claude to explain what went wrong and how to avoid it. Then several different models look over the proposed fix. The result is usually two changes: clearer wording in their rules, and removing the old information that led the agent astray. Their experience is that each round makes a repeat less likely.&lt;/p&gt;

&lt;p&gt;The purge is the part I always underestimate. Fixing the rule takes a minute; finding every old note that still says the opposite can take an afternoon.&lt;/p&gt;

&lt;h2&gt;
  
  
  What doesn't stick
&lt;/h2&gt;

&lt;p&gt;The same person who reviewed a month of sessions had also planned a weekly ritual: once a week, the agent suggests a few rule changes and they approve or reject them. I asked whether it worked. Their answer was refreshingly honest: it never actually happened. There was no trace of a single review, so they shelved that part of their setup.&lt;/p&gt;

&lt;p&gt;That matched my own experience exactly. Anything that depends on me remembering to do it weekly just doesn't happen. What stuck, for them and for me, were the things that run on their own: the check that fails, the file that's deleted, the line at the top of the stale config.&lt;/p&gt;

&lt;p&gt;And one reply was more skeptical than all the others: skip memory features entirely. When I asked what had gone wrong for them, it was both problems at once, outdated notes and irrelevant ones getting pulled in. Their broader point was that agents shouldn't be the ones deciding how other agents get instructed, at least for open-ended work. I think that's fair. The memory that helped me was never the stuff the agent chose to save on its own. It was the decisions I told it to save on purpose, with the reason attached.&lt;/p&gt;

&lt;h2&gt;
  
  
  The habit underneath all of it
&lt;/h2&gt;

&lt;p&gt;Look back at every approach above and they share one move: &lt;strong&gt;deal with the old note in the same step you write the new one.&lt;/strong&gt; Delete it, overwrite it, or mark it replaced. Just don't leave it standing next to its replacement.&lt;/p&gt;

&lt;p&gt;In practice that's one sentence to the agent, at the moment you change your mind:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"This replaces what we decided about sessions last week. Find the old note and update it."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Cheap now. Expensive next week, after the agent has rebuilt the thing you tore out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where ContextForge fits, and where it doesn't
&lt;/h2&gt;

&lt;p&gt;Straight answer, since I build it. ContextForge gives one memory to Claude Code, Cursor, Copilot, Claude Desktop and Windsurf. For this problem it helps with the retiring step:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;memory_update&lt;/code&gt; rewrites a memory in place, so you're not adding a second version next to the first.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;memory_relate&lt;/code&gt; links a new decision to an old one as &lt;code&gt;supersedes&lt;/code&gt;, so a search that finds one brings the other along.&lt;/li&gt;
&lt;li&gt;Memories can be tied to files and commits, and the agent is told when the code they describe has changed since, so stale notes get flagged instead of trusted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What it does &lt;strong&gt;not&lt;/strong&gt; do is spot contradictions for you. I tried to build exactly that after this thread: warn on save when a new memory looks like an old one. I tested it on my own real memories and it didn't work. Similarity tells you two notes are about the same topic, and in a real project most notes are about the same few topics. I'll write that experiment up separately, with the numbers.&lt;/p&gt;

&lt;p&gt;So the habit still applies. ContextForge makes retiring an old decision easier. It doesn't do it for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Should I delete old decisions or keep them?&lt;/strong&gt;&lt;br&gt;
Keep the reasoning, retire the instruction. Delete and let git hold the history, or keep the old record clearly marked as superseded. What you want to avoid is two unmarked versions side by side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is CLAUDE.md enough?&lt;/strong&gt;&lt;br&gt;
For rules every session must follow, it's the right place. For decisions with a history, it tends to bloat and &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;go stale&lt;/a&gt;. Most people in the thread used it for rules and kept decisions somewhere else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can a tool catch contradicting decisions automatically?&lt;/strong&gt;&lt;br&gt;
Not reliably by comparing how similar notes are, in my testing. A model that reads both notes might, but that's slower and costs more on every edit.&lt;/p&gt;

&lt;h2&gt;
  
  
  One thing to do today
&lt;/h2&gt;

&lt;p&gt;Think of the last decision you reversed on your current project. Before you close this session, ask your agent to find every note, doc or file that still states the old one. If it finds more than one, you've just found next week's bug early.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>Knowledge Graph Memory for AI Coding Assistants</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Tue, 17 Nov 2026 17:53:39 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/knowledge-graph-memory-for-ai-coding-assistants-5032</link>
      <guid>https://dev.to/alfredoizjr/knowledge-graph-memory-for-ai-coding-assistants-5032</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/knowledge-graph-memory-for-ai-coding-assistants" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Knowledge graph memory for AI coding assistants sounds like something you'd need a research team for. It isn't. It means your notes know about each other: this decision replaced that one, this bug depends on that config, these two rules contradict. That's the whole idea, and I learned why it matters from my own blog pipeline this morning.&lt;/p&gt;

&lt;h2&gt;
  
  
  The morning my notes didn't know about each other
&lt;/h2&gt;

&lt;p&gt;I run a small n8n workflow that drafts a blog post twice a week. On November 13 I threw one of its drafts away because it repeated a post I'd published ten days earlier. I wrote down the fix: "add this topic to the blocked list." I saved that note. Done.&lt;/p&gt;

&lt;p&gt;Today the same workflow wrote the same post again.&lt;/p&gt;

&lt;p&gt;The fix was real. It just lived in a file that the workflow had stopped reading weeks before. An older note of mine said exactly that: "the workflow reads its config from its own database, not from the JSON in the repo." Two true notes, saved two months apart, and nothing connected them. When I searched my memory for "blocked topics," I got the new note. The old one, the one that made the new one useless, didn't rank, because it doesn't contain the words "blocked topics" anywhere.&lt;/p&gt;

&lt;p&gt;That's the gap a knowledge graph closes. Not more memory. Memory with links.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a flat list of notes isn't enough
&lt;/h2&gt;

&lt;p&gt;Most memory for coding agents works like a search box. You save text, it gets turned into an embedding, and later the agent asks a question and gets back the notes that sound most similar. That works well for facts that stand alone: "we use pnpm," "the staging database is read-only on Fridays."&lt;/p&gt;

&lt;p&gt;It breaks on the things that matter most in a real codebase, which are almost never standalone:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decisions that replaced other decisions.&lt;/strong&gt; "Use Redis for sessions" and, three weeks later, "drop Redis, sessions go in Postgres." Both are in memory. Similarity search happily returns the old one, and your agent rebuilds the thing you already tore out. I wrote a whole post on &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;why AI coding agents contradict earlier decisions&lt;/a&gt;, and this is most of the answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Things that only make sense together.&lt;/strong&gt; A bug note is half useless without the config it depends on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rules that conflict.&lt;/strong&gt; Two notes that disagree are worse than none, unless something marks them as disagreeing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Similarity can't see any of that. "Supersedes" isn't a word that appears in either note. It's a fact &lt;em&gt;about&lt;/em&gt; the two notes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a knowledge graph adds
&lt;/h2&gt;

&lt;p&gt;A knowledge graph stores those facts explicitly. Each note is a node. Each link between two notes has a type that says how they relate. In ContextForge there are ten: &lt;code&gt;related_to&lt;/code&gt;, &lt;code&gt;references&lt;/code&gt;, &lt;code&gt;depends_on&lt;/code&gt;, &lt;code&gt;implements&lt;/code&gt;, &lt;code&gt;extends&lt;/code&gt;, &lt;code&gt;part_of&lt;/code&gt;, &lt;code&gt;similar_to&lt;/code&gt;, &lt;code&gt;derived_from&lt;/code&gt;, &lt;code&gt;supersedes&lt;/code&gt; and &lt;code&gt;contradicts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Applied to my morning, it looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"Block topic X in the workflow"  --depends_on--&amp;gt;  "Workflow reads config from its DB, not the repo JSON"
"Dedupe reads live published posts"  --supersedes--&amp;gt;  "Dedupe reads articles/*.md"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the first link in place, a search for blocked topics brings back both notes, and the second one tells the agent where the change actually has to go.&lt;/p&gt;

&lt;p&gt;That's what the links do at query time in ContextForge. When the agent searches, results that are linked to each other get a boost, and the top results pull in their linked neighbours even when those neighbours wouldn't have scored high enough on their own. The agent can also ask directly: "what's connected to the session-storage decision?" and get the list, with the link types, from &lt;code&gt;memory_list_relationships&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How the links get made
&lt;/h2&gt;

&lt;p&gt;Here's the part most posts about knowledge graphs skip: someone has to make the links.&lt;/p&gt;

&lt;p&gt;In ContextForge, links get created in three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;You ask your agent.&lt;/strong&gt; "The Redis removal supersedes the old session decision, link them." The agent calls &lt;code&gt;memory_relate&lt;/code&gt; with the two items and the type. This is how I make most of mine, usually right after a decision, while the context is still in the session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;From the dashboard.&lt;/strong&gt; Open an item, go to Related Items, click Link, pick the target and the type. Useful for cleaning up after the fact.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;By importing a graph you already have.&lt;/strong&gt; If you've been using the MCP reference Knowledge Graph Memory Server, its JSONL export (entities and relations) imports directly. Entities become items, relations become links.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;What ContextForge does &lt;strong&gt;not&lt;/strong&gt; do today is guess the links for you. It won't read two notes and decide one supersedes the other. I've thought about it, and I'm wary of it for now: an automatic "supersedes" that's wrong hides a correct decision, which is exactly the failure I'm trying to prevent. So the graph is only as good as the links you or your agent bother to make.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it's worth it, and where it isn't
&lt;/h2&gt;

&lt;p&gt;Honest version: for a lot of projects, you don't need a graph.&lt;/p&gt;

&lt;p&gt;If you're working alone on something small, and your decisions rarely get reversed, plain search over well-written notes is enough. A good &lt;code&gt;CLAUDE.md&lt;/code&gt; plus a handful of saved decisions will carry you far. Adding links would be ceremony.&lt;/p&gt;

&lt;p&gt;The graph starts paying off when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Decisions get reversed.&lt;/strong&gt; Any project old enough to have changed its mind. &lt;code&gt;supersedes&lt;/code&gt; is the single most useful link type I have.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;More than one agent or person writes to the same memory.&lt;/strong&gt; Two sessions saving conflicting rules is common, and &lt;code&gt;contradicts&lt;/code&gt; at least makes the conflict visible instead of random.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notes reference each other by meaning, not by words.&lt;/strong&gt; Like my workflow notes this morning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And the costs are real. You have to make the links, which is one more sentence to your agent but still a habit you need to build. And there's no visual graph map in the dashboard; you see links per item, in its Related Items list, and as "Linked to" badges in the item list. If you were hoping to stare at a constellation of your project, that's not what this is.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you want to try it
&lt;/h2&gt;

&lt;p&gt;The cheapest test: next time you reverse a decision, don't just save the new one. Tell your agent to link it to the old one with &lt;code&gt;supersedes&lt;/code&gt;. Then, a week later, ask about that topic and see which note comes back first.&lt;/p&gt;

&lt;p&gt;ContextForge works with Claude Code, Cursor, GitHub Copilot, Claude Desktop and Windsurf through MCP. Install for Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add contextforge -e &lt;span class="nv"&gt;CONTEXTFORGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;key&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; -- npx -y contextforge-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There's a free tier that's enough to find out whether links change how your agent answers. The &lt;a href="https://contextforge.dev/docs/knowledge-graph" rel="noopener noreferrer"&gt;knowledge graph docs&lt;/a&gt; list every link type with examples. And if you're still deciding where your memory should live at all, I wrote about &lt;a href="https://contextforge.dev/blog/self-hosted-memory-for-ai-agents" rel="noopener noreferrer"&gt;what self-hosting it actually takes&lt;/a&gt;, including the part where ContextForge isn't the right fit.&lt;/p&gt;

&lt;p&gt;I'll keep adding links to my own pipeline notes. After this morning, the first one is obvious.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>productivity</category>
      <category>programming</category>
    </item>
    <item>
      <title>How to Make ChatGPT Remember Your Project</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Fri, 13 Nov 2026 17:41:19 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/how-to-make-chatgpt-remember-your-project-3oa8</link>
      <guid>https://dev.to/alfredoizjr/how-to-make-chatgpt-remember-your-project-3oa8</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/how-to-make-chatgpt-remember-your-project" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you want to make ChatGPT remember your project, there is no single setting for it. There are five, they work differently, and the one almost everyone reaches for first — the global custom instructions box in settings — is the worst place to put anything project-specific.&lt;/p&gt;

&lt;p&gt;I should say where I'm standing. I build a memory layer for coding agents, and I still open ChatGPT most weeks for the work that isn't code. Every article on this blog gets cross-posted by hand to dev.to, Medium and LinkedIn, and each of those needs its own blurb. So three times a post, I sit down to write "here's what ContextForge is" to a model that has no idea, because last week's conversation is gone. A person who sells continuity, re-explaining himself to a chat window.&lt;/p&gt;

&lt;p&gt;I spent a while blaming the model. It was my setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five places your project can live
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Custom instructions.&lt;/strong&gt; The personalization block in settings. Short, always on, and global — the same text follows you into every conversation you have.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project instructions.&lt;/strong&gt; The same idea, scoped to one project. Open the project, hit the ••• menu, choose Project settings. These apply only inside that project, and they override your global custom instructions. This is the one most people don't know exists, and it's the one that matters most here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Saved memories.&lt;/strong&gt; Details ChatGPT keeps about you, either because you asked it to or because it decided they were useful. Settings → Personalization → Memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reference chat history.&lt;/strong&gt; A control that lets ChatGPT draw on your past conversations instead of only on saved memories. The broadest of the five and the hardest to inspect.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Projects.&lt;/strong&gt; A container with its own chats, its own files, its own instructions and its own memory setting. This is the closest thing ChatGPT has to "a place where my project lives."&lt;/p&gt;

&lt;p&gt;One caveat before you go changing things, and it's a real one: OpenAI says memory features and controls vary by plan, region, platform and workspace. Accounts on the newer improved memory see a memory summary that ChatGPT keeps updating, rather than an editable list of individual items, and may not show the separate toggles I'm about to describe. Check what your own settings actually offer before trusting any guide, including this one.&lt;/p&gt;

&lt;p&gt;Two wiring details worth knowing. Turning off &lt;em&gt;Reference saved memories&lt;/em&gt; also turns off &lt;em&gt;Reference chat history&lt;/em&gt;; the reverse isn't true, so you can keep saved memories while cutting history recall but not the other way round. And when ChatGPT uses personal context, Sources can appear under the response, showing you which past chat, saved memory, custom instruction or file contributed. OpenAI is explicit that Sources may not show every factor — but it's the closest thing to a debugger you get, and hardly anyone looks at it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where each one breaks
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Custom instructions are global, and your project isn't.&lt;/strong&gt; Anything you put there to help with one project is dead weight in every other conversation. This is the mistake worth undoing today: move it into project instructions, which override the global block anyway, and your schema stops showing up while you're asking for a dinner recipe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Saved memories don't do what you think they do.&lt;/strong&gt; You don't control what goes in — the model decides what's worth keeping. It will faithfully remember that you prefer TypeScript and miss the architectural decision you spent an afternoon reaching. And deleting a chat doesn't remove a memory that came from it; people clear their history, assume they've reset, and wonder why ChatGPT still believes something about them.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Chat history recall is best-effort, not retrieval.&lt;/strong&gt; The model decides what's relevant to your question. You have no way to say "the thing we settled three weeks ago, in the long conversation, about the webhook." When it works it feels like magic. When it doesn't, you can't tell whether the information is missing or simply wasn't retrieved, and those two problems have different fixes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Projects isolate, which cuts both ways.&lt;/strong&gt; With project-only memory on, your saved memories are not referenced inside that project, and its chats can't see conversations outside it — in either direction. Great for a clean workspace, startling the first time ChatGPT seems to have forgotten who you are. Sharing a project switches it to project-only permanently, and that sticks even after everyone else leaves.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Files are read, not remembered.&lt;/strong&gt; Project files get pulled in when relevant. They don't become decisions ChatGPT holds onto.&lt;/p&gt;

&lt;h2&gt;
  
  
  A setup that actually holds
&lt;/h2&gt;

&lt;p&gt;Here's what I use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One Project per real project.&lt;/strong&gt; Not per topic, not per week. The container should match the thing in your head.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Put the project's rules in project instructions, not the global box.&lt;/strong&gt; How you want it to write, what it should never assume, which tone. Scoped, overriding, and invisible everywhere else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decide the memory mode on purpose.&lt;/strong&gt; Project-only memory keeps your general account memory out — useful for client work or a codebase with its own conventions. Two things the docs will tell you only after you've gone looking: it requires &lt;em&gt;Reference saved memories&lt;/em&gt; and &lt;em&gt;Reference chat history&lt;/em&gt; turned on in your personal settings (on Business and Enterprise, memory also has to be enabled for the workspace), and changes can take a few hours to take effect. Switching a project to project-only also pulls that project's information out of the memory used elsewhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Write one brief, as a file, and upload it.&lt;/strong&gt; This does the heavy lifting. Not a transcript — a reference, a page or two:&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;# &amp;lt;project&amp;gt; — brief
&lt;/span&gt;What it is: one paragraph, as if to a new contractor.
Stack: languages, frameworks, services, versions that matter.
Decisions made: the choice, and the reason. "Postgres over Mongo — relational reporting."
Out of scope: what we decided NOT to do, so it stops getting suggested.
Vocabulary: our names for things, and what they map to.
Open questions: what's genuinely undecided.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When an answer comes back wrong-headed, don't re-explain in chat. Fix the brief, re-upload.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Audit instead of arguing.&lt;/strong&gt; When a response is off, check Sources. If a stale saved memory is steering things, delete the memory rather than correcting it in conversation for the rest of the week.&lt;/p&gt;

&lt;p&gt;The brief file carries the weight rather than memory because you own it. You can read it, diff it, and see when it has gone stale — which it will, the same way a &lt;code&gt;CLAUDE.md&lt;/code&gt; &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;drifts out of sync with the code it describes&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this still fails: the second tool
&lt;/h2&gt;

&lt;p&gt;Everything above lives inside ChatGPT. That's fine until you open a second tool.&lt;/p&gt;

&lt;p&gt;The decision you explained so carefully in a ChatGPT Project isn't available to Claude Code when it's editing the very file that decision was about. It isn't available to Cursor either. Each tool keeps its own idea of what it knows about you, and none of them compare notes. If one assistant does all your work, stop reading — the setup above is genuinely enough. If you use two or three, you haven't solved the re-explaining, you've just moved it from every session to every tool. I wrote about &lt;a href="https://contextforge.dev/blog/shared-memory-for-multiple-ai-coding-agents" rel="noopener noreferrer"&gt;what it takes to give several coding agents one shared memory&lt;/a&gt; if that's where you are.&lt;/p&gt;

&lt;p&gt;The brief file is the only piece of the setup that makes the jump, and only because it's a file you control.&lt;/p&gt;

&lt;h2&gt;
  
  
  What ContextForge can and can't do here
&lt;/h2&gt;

&lt;p&gt;Straight answer, since this is my product: &lt;strong&gt;you cannot connect ContextForge to ChatGPT today.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;ChatGPT talks to custom MCP servers over a remote endpoint only — SSE or streaming HTTP — and full MCP support is currently limited to Business and Enterprise/Edu accounts on ChatGPT web. Our MCP server is a local stdio process. There's no remote endpoint to point ChatGPT at, so there's no connector to install, and a tunnel doesn't help because there's no HTTP server at the other end of it.&lt;/p&gt;

&lt;p&gt;What does exist: you can &lt;a href="https://contextforge.dev/blog/import-your-ai-memory-into-contextforge-claude-code-chatgpt-and-knowledge-graph" rel="noopener noreferrer"&gt;import your existing ChatGPT memory into ContextForge&lt;/a&gt;, which is one-way and mostly useful as a migration. And if the code half of your work happens in Claude Code, Cursor, Copilot or Claude Desktop, that's the half I built for: one memory those four share, tied to files and commits, so it can tell you when a note has gone stale.&lt;/p&gt;

&lt;p&gt;If ChatGPT is the only assistant you use, the Projects setup above is the whole answer and you can skip my product entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;If I delete a chat, does ChatGPT forget what it learned there?&lt;/strong&gt;&lt;br&gt;
No. Saved memories are stored separately from chat history, so deleting the original chat doesn't automatically delete a memory created from it. Delete the memory itself under Settings → Personalization → Memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do Projects have their own memory?&lt;/strong&gt;&lt;br&gt;
Effectively, yes. A project can run on project-only memory, which keeps your saved memories out of it and stops its chats from referencing conversations outside the project, or being referenced by them. Shared projects always work this way, and the switch can't be undone.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do project instructions replace my custom instructions?&lt;/strong&gt;&lt;br&gt;
Inside that project, yes — project instructions override your global custom instructions. Outside it, the global block still applies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I connect ChatGPT to an MCP memory server?&lt;/strong&gt;&lt;br&gt;
Only a remote one, over SSE or streaming HTTP, and full MCP support is currently a Business/Enterprise-tier feature on ChatGPT web. A memory server running on your laptop isn't reachable unless you expose it over HTTPS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Won't a bigger context window solve this?&lt;/strong&gt;&lt;br&gt;
No. A longer window holds more of &lt;em&gt;this&lt;/em&gt; conversation, not more of your project's history, and answer quality degrades well before you hit the limit. More on &lt;a href="https://contextforge.dev/blog/context-rot-bigger-windows-wont-save-you" rel="noopener noreferrer"&gt;why bigger context windows don't fix forgetting&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you also code with an agent
&lt;/h2&gt;

&lt;p&gt;The Projects setup costs nothing to try this afternoon, and project instructions alone will fix more than you'd expect. If your problem is bigger than one window — several tools, each re-learning the same project — that's what I build, and there's a free tier to find out whether it changes how you work.&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>ai</category>
      <category>productivity</category>
      <category>mcp</category>
    </item>
    <item>
      <title>How to Keep Track of What Your AI Agents Are Doing</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Tue, 10 Nov 2026 20:48:43 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/how-to-keep-track-of-what-your-ai-agents-are-doing-3h1p</link>
      <guid>https://dev.to/alfredoizjr/how-to-keep-track-of-what-your-ai-agents-are-doing-3h1p</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/how-to-keep-track-of-what-your-ai-agents-are-doing" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can keep track of what your AI agents are doing right up until the moment you can't, and in my case the warning sign was a blog post that never appeared.&lt;/p&gt;

&lt;p&gt;Here is what had happened. I have a pipeline that drafts posts for this blog twice a week — a scheduled job, a local model, no human in the loop until the draft lands in my dashboard. On Tuesday morning it ran, picked a topic, wrote eleven hundred words, ran them through a quality check, and tried to file the draft. The API rejected it: a post with that exact slug already existed. I had published that same article five days earlier.&lt;/p&gt;

&lt;p&gt;The part that bothers me is not the wasted run. It is that the pipeline reported the run as a &lt;strong&gt;success&lt;/strong&gt;, and I only found out because I noticed, hours later, that there was no new post. The duplicate was caught by a unique constraint on a database column. Not by the system. Not by me. By a schema decision I made months ago for unrelated reasons.&lt;/p&gt;

&lt;h2&gt;
  
  
  This is not a memory problem
&lt;/h2&gt;

&lt;p&gt;My first instinct was to reach for memory, because that is the thing I build. It was the wrong instinct.&lt;/p&gt;

&lt;p&gt;The pipeline did have a record of which topics were already covered. A list, maintained by hand, sitting in the code. It was simply out of date, because every time I publish something I have to remember to go add it — and the whole point of delegating the work was to stop holding things in my head.&lt;/p&gt;

&lt;p&gt;Memory answers &lt;em&gt;what did we decide&lt;/em&gt;. That is a real problem and I have &lt;a href="https://contextforge.dev/blog/why-your-ai-forgets-everything" rel="noopener noreferrer"&gt;written about it plenty&lt;/a&gt;. But it is not this one. This one is &lt;em&gt;what work exists, where is it, and what state is it in&lt;/em&gt; — and no amount of recalled context answers it, because the answer isn't something you once said. It is something the work itself has to carry.&lt;/p&gt;

&lt;p&gt;It is also not the same as knowing what is running right now. I wrote about that separately: when you have several agents open at once they collide, and the fix is a live presence layer (&lt;a href="https://contextforge.dev/blog/one-developer-five-terminals-zero-awareness" rel="noopener noreferrer"&gt;one developer, five terminals, zero awareness&lt;/a&gt;). That answers &lt;em&gt;what's happening&lt;/em&gt;. What I am describing here is the slower, quieter question — &lt;em&gt;what's there&lt;/em&gt; — and it is the one that bit me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four pieces, in order
&lt;/h2&gt;

&lt;p&gt;The structure that fixes this is boring, which is probably why it took me so long to take it seriously. Four nested things, each answering a different question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A project is the boundary.&lt;/strong&gt; One product, one repo, one piece of work with edges. It exists so that when an agent asks a question, the answer isn't drawn from everything you have ever done. Your agent links to it once per machine and stops guessing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;memory_link_project   → ties this directory to a project
memory_current_project → confirms which one it's in
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;A space is a folder by topic, inside the project.&lt;/strong&gt; API, Frontend, Infra, Decisions. Keep them broad — the pull toward a space per feature is strong and you should resist it, because a hundred spaces is the same as none. Spaces are what make retrieval land near the right thing instead of somewhere in the general vicinity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An item is a fact or a decision.&lt;/strong&gt; "We chose Postgres over DynamoDB because the access pattern is relational." Tagged, searchable, attached to the files it describes. This is the memory layer proper, and if you have read anything else on this blog you already know my position: the value is in what gets written down, not in the retrieval being clever.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A task is work that hasn't happened yet.&lt;/strong&gt; This is the piece people skip, and it is the one that would have saved me on Tuesday. A task has an owner, a priority, a due date, and a status that moves from pending to in progress to resolved. It is the only one of the four that represents the future rather than the past.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tasks_create        → with title, priority, due date
tasks_list          → pending, sorted by due date
tasks_what_next     → "what should I pick up?"
tasks_start / tasks_resolve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Put the four together and the question "what is going on with this project" has a place to be answered from, instead of being reconstructed every morning from your own recollection.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it looks like from inside the agent
&lt;/h2&gt;

&lt;p&gt;Here is the part that is easy to miss if you only ever look at a dashboard: the point is not that you can go look. The point is that &lt;strong&gt;the agent looks, before it does anything.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My own &lt;code&gt;CLAUDE.md&lt;/code&gt; opens every session by doing five things in parallel: query the project memory, pull the last few commits, list tasks that are in progress, list tasks that are pending sorted by due date, and check whether another session is already working in this project. Then it tells me what it found before it answers whatever I asked.&lt;/p&gt;

&lt;p&gt;It takes about two seconds and it has changed how the first five minutes of my day go. I don't open a session and ask "where were we". The session tells me, and if something is overdue it says so first.&lt;/p&gt;

&lt;p&gt;That is also why the structure has to live behind MCP rather than in a project management tool. A tool you have to open is a tool you check when you remember to. A tool your agent reads at session start is one you can't forget.&lt;/p&gt;

&lt;p&gt;Setting it up is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add contextforge -s user \
  -e &lt;span class="nv"&gt;CONTEXTFORGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-api-key-here \
  -- npx -y contextforge-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then &lt;code&gt;npx contextforge-mcp init&lt;/code&gt;, which writes the session-start section into your &lt;code&gt;CLAUDE.md&lt;/code&gt; so the agent actually does the looking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this doesn't save you
&lt;/h2&gt;

&lt;p&gt;I want to be straight about the limits, because three of them are real and one of them is the reason I lost a run on Tuesday.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If nothing gets saved, there is nothing to see.&lt;/strong&gt; The structure is only as good as what the agent writes into it, and agents under-save. I am still tuning this and it is the part of the product I am least satisfied with.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tasks go stale like every tracker ever built.&lt;/strong&gt; There is a freshness check that flags memories when the code they describe changes, but it does not watch your task list. A task nobody resolved looks exactly like a task nobody started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It does not tell you what is happening right now.&lt;/strong&gt; Different problem, different answer, linked above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And it will not make you understand code you did not read.&lt;/strong&gt; Structure over delegated work is not the same thing as knowing your codebase, and conflating the two is its own trap (&lt;a href="https://contextforge.dev/blog/vibe-coding-is-a-trap-why-ai-generated-code-you-don-t-understand-will-cost-you" rel="noopener noreferrer"&gt;vibe coding is a trap&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;My Tuesday failure was the first one. The pipeline never recorded the posts it had already written as anything an automated check could read. The list lived in a comment, maintained by a human who had other things to do.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to do today
&lt;/h2&gt;

&lt;p&gt;Pick the project you have most lost the thread on. Then, in order: link it, create three or four broad spaces, and — this is the one that matters — write down the four or five things you are actually waiting on as tasks, with due dates. Not a backlog. The things that are genuinely live.&lt;/p&gt;

&lt;p&gt;Then open a session tomorrow morning and let the agent tell you what it found.&lt;/p&gt;

&lt;p&gt;The test is simple. If your agent can answer "what is pending on this project, and what did we decide about it" without you explaining anything first, the structure is doing its job. If it can't, the work is still living in your head, and the next thing you delegate will go missing the same way mine did.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>claude</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Give Claude Code Long Term Memory (2026)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Thu, 05 Nov 2026 19:31:16 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/how-to-give-claude-code-long-term-memory-2026-3cpo</link>
      <guid>https://dev.to/alfredoizjr/how-to-give-claude-code-long-term-memory-2026-3cpo</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/how-to-give-claude-code-long-term-memory" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;How to give Claude Code long term memory is a question I get in some form every week, and the honest answer is that there is no single switch. There are four layers, each one remembers a different kind of thing, and most people stop after the first.&lt;/p&gt;

&lt;p&gt;I build ContextForge, a memory layer for Claude Code, Cursor and Copilot, so I have an obvious interest here. I'll be clear about where my own tool fits and where it doesn't.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; put stable rules in &lt;code&gt;CLAUDE.md&lt;/code&gt;, leave a handoff note at the end of each session, add a memory server over MCP for decisions and facts that change, and make sure that memory gets re-injected after Claude Code compacts. Each layer covers what the one before it loses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Claude Code forgets in the first place
&lt;/h2&gt;

&lt;p&gt;Claude Code has a context window, not a memory. A session can hold a lot (200k tokens on the standard tier, and 1M on the larger one), but when it ends, everything in it is gone. When it gets long, Claude Code compacts it: the conversation is replaced with a summary, and the summary drops details. The decision you made two hours ago about the retry policy is exactly the kind of detail that goes.&lt;/p&gt;

&lt;p&gt;So "long term memory" really means two different problems: surviving the end of a session, and surviving compaction inside one. The layers below handle both.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 1: &lt;code&gt;CLAUDE.md&lt;/code&gt; for the things that don't change
&lt;/h2&gt;

&lt;p&gt;Claude Code reads &lt;code&gt;CLAUDE.md&lt;/code&gt; from the repo root at the start of every session. That makes it the right place for stable facts: how to run the tests, which package manager you use, naming conventions, the rule that nobody touches the migrations folder without asking.&lt;/p&gt;

&lt;p&gt;It is the wrong place for anything that changes often. People try to turn it into a diary, and the file goes stale within a couple of weeks. A stale rule is worse than no rule, because Claude follows it with confidence. Keep it under a page, and treat every line as something you'd be fine with being enforced for the next six months. Anthropic's own guidance on &lt;a href="https://docs.anthropic.com/en/docs/claude-code/memory" rel="noopener noreferrer"&gt;memory in Claude Code&lt;/a&gt; covers the file locations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 2: a handoff note at the end of each session
&lt;/h2&gt;

&lt;p&gt;Before you close a session, ask Claude Code to write down where things stand: what's done, what's half done, what it decided and why, what it would do next. A few lines in a &lt;code&gt;NOTES.md&lt;/code&gt; or the task tracker are enough. The next session starts by reading it.&lt;/p&gt;

&lt;p&gt;This is cheap and it works, which is why I wrote a whole post on it: &lt;a href="https://contextforge.dev/blog/claude-code-session-handoff-how-to-resume-work" rel="noopener noreferrer"&gt;Claude Code session handoff: how to resume work without re-explaining everything&lt;/a&gt;. Its weakness is that it's manual. The day you forget to write the note is the day you needed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 3: a memory server over MCP for decisions and facts
&lt;/h2&gt;

&lt;p&gt;This is the layer that makes the memory searchable instead of a pile of notes. The Model Context Protocol lets Claude Code call tools from an external server, and a memory server gives it two that matter: one to save a memory, one to search them by meaning.&lt;/p&gt;

&lt;p&gt;With ContextForge, the setup in a repo is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That links the folder to a project, so every agent working in that repo (Claude Code today, Cursor tomorrow) searches the same memories. From then on, when something worth keeping happens, you say it: "Save to ContextForge: we dropped automatic retries on the payment webhook because they double-charged a customer." Weeks later, in a new session, "why don't we retry the payment webhook?" finds it, because the search is semantic, not keyword matching.&lt;/p&gt;

&lt;p&gt;Two honest notes. First, it saves what the agent is told to save, either by you in the moment or by rules in &lt;code&gt;CLAUDE.md&lt;/code&gt; that tell it what counts as worth keeping. It does not read your mind, and a memory nobody writes to is empty. Second, this is hosted: the MCP server is open source, the storage behind it is not something you run yourself. If your constraints say the data cannot leave your machine, I wrote up &lt;a href="https://contextforge.dev/blog/self-hosted-memory-for-ai-agents" rel="noopener noreferrer"&gt;what self-hosted memory for AI agents actually takes&lt;/a&gt;, including the options that aren't mine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layer 4: get the memory back after compaction
&lt;/h2&gt;

&lt;p&gt;This is the step almost everyone misses. Even with a memory server, compaction inside a long session leaves Claude Code with a summary and no idea that the memories exist until it thinks to search. So after a compaction it quietly goes on with less context than it had a minute earlier.&lt;/p&gt;

&lt;p&gt;ContextForge handles this with a Claude Code hook that &lt;code&gt;init&lt;/code&gt; installs: right after every compaction, it re-injects your most recent memories for that project and your pending tasks. You don't have to notice the compaction happened. If you don't use ContextForge, you can get a weaker version of the same thing with a hook that re-reads your handoff note after compaction. The post on &lt;a href="https://contextforge.dev/blog/how-to-stop-claude-code-from-losing-context" rel="noopener noreferrer"&gt;how to stop Claude Code from losing context&lt;/a&gt; walks through the hook mechanics.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four layers side by side
&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;Remembers&lt;/th&gt;
&lt;th&gt;Survives&lt;/th&gt;
&lt;th&gt;Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stable rules and project facts&lt;/td&gt;
&lt;td&gt;New sessions, compaction&lt;/td&gt;
&lt;td&gt;Goes stale if you put changing things in it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Handoff note&lt;/td&gt;
&lt;td&gt;Where you left off&lt;/td&gt;
&lt;td&gt;New sessions&lt;/td&gt;
&lt;td&gt;Manual, easy to skip&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MCP memory server&lt;/td&gt;
&lt;td&gt;Decisions, facts, why things are the way they are&lt;/td&gt;
&lt;td&gt;New sessions, other tools, other machines&lt;/td&gt;
&lt;td&gt;You have to tell it what to save&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Post-compaction recall&lt;/td&gt;
&lt;td&gt;Everything above, mid-session&lt;/td&gt;
&lt;td&gt;Compaction&lt;/td&gt;
&lt;td&gt;Needs a hook; only ContextForge installs it for you today&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Keeping the memory honest
&lt;/h2&gt;

&lt;p&gt;A long term memory accumulates mistakes. The database moved, the API got renamed, and the memory still says the old thing. ContextForge has tools for this: Claude Code can check a memory's freshness against recent commits, confirm it, correct it, or forget it, and the git integration keeps commits and pull requests in the same store so the memory can tell when the code moved on. The knowledge graph links related memories, so correcting one shows you what else depended on it. None of that is magic. It's the difference between a memory you trust and one you learn to ignore.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Code have built-in long term memory?&lt;/strong&gt;&lt;br&gt;
It has &lt;code&gt;CLAUDE.md&lt;/code&gt; files, which it reads at the start of every session, and that's it. Nothing is saved from a session unless you or a tool writes it somewhere.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is &lt;code&gt;CLAUDE.md&lt;/code&gt; enough on its own?&lt;/strong&gt;&lt;br&gt;
For a small project with stable conventions, often yes. It stops being enough when the things you need remembered change weekly, because the file goes stale and Claude Code follows stale rules confidently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does memory survive compaction?&lt;/strong&gt;&lt;br&gt;
Not by itself. Compaction replaces the conversation with a summary. You need something that re-injects context afterwards: ContextForge's post-compaction recall does it automatically, or a hook that re-reads your notes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can Cursor and Claude Code share the same memory?&lt;/strong&gt;&lt;br&gt;
Over MCP, yes. ContextForge links a repo to one project, and every MCP client working in that repo reads and writes the same memories.&lt;/p&gt;
&lt;h2&gt;
  
  
  Where to start
&lt;/h2&gt;

&lt;p&gt;If you have nothing today, write the &lt;code&gt;CLAUDE.md&lt;/code&gt; and the handoff note this week; that alone fixes most of the pain. When you catch yourself re-explaining a decision for the third time, add the memory server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then save one real decision, close the session, open a new one, and ask about it. That first answer from a fresh session is when it clicks.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>mcp</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Self-Hosted Memory for AI Agents: What It Takes</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Tue, 03 Nov 2026 16:32:16 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/self-hosted-memory-for-ai-agents-what-it-takes-4n3l</link>
      <guid>https://dev.to/alfredoizjr/self-hosted-memory-for-ai-agents-what-it-takes-4n3l</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/self-hosted-memory-for-ai-agents" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Self-hosted memory for AI agents sounds like a database problem, and the database turns out to be the easy part.&lt;/p&gt;

&lt;p&gt;I know because I went the other way. I build ContextForge, a memory layer for Claude Code, Cursor and Copilot, and I run it as a hosted service. The MCP server you install is open source. The storage behind it is not something you can run on your own machine today. Every few weeks someone asks me, politely, why not. This post is my honest answer, including the cases where you should not use what I built.&lt;/p&gt;

&lt;h2&gt;
  
  
  What "memory" has to do before it counts
&lt;/h2&gt;

&lt;p&gt;Strip away the vendor language and an agent memory does three jobs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Save a decision with its reason.&lt;/strong&gt; "We use GraphQL for the API layer" is a fact. "Because the mobile screens needed a dozen REST calls each" is the part that stops the next agent from reopening the question.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recall by meaning, at the right moment.&lt;/strong&gt; Not a keyword grep. The agent working on &lt;code&gt;payments/webhook.ts&lt;/code&gt; should get the note about the double-charge bug without knowing it exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notice when it goes stale.&lt;/strong&gt; Someone renames the file the note talks about. If the memory doesn't know, every agent that reads it is working from an old map. Static files have the &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;same problem&lt;/a&gt;, just slower.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Any option below that does only the first job is a notes folder. That's fine, as long as you call it that.&lt;/p&gt;

&lt;h2&gt;
  
  
  The four ways to self-host it
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Files in the repo
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;.cursorrules&lt;/code&gt;, a &lt;code&gt;docs/decisions/&lt;/code&gt; folder. Zero infrastructure, versioned with the code, readable by every tool and every teammate who clones the repo.&lt;/p&gt;

&lt;p&gt;This is where most people should start, and where I started. It fails in two predictable ways. Nothing recalls by meaning; the agent reads what fits in context and skips the rest. And nothing flags staleness; the file says whatever it said the day someone last edited it. I wrote about &lt;a href="https://contextforge.dev/blog/cursor-rules-vs-persistent-memory" rel="noopener noreferrer"&gt;cursor rules versus persistent memory&lt;/a&gt; if you want the long version.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. A local MCP memory server
&lt;/h3&gt;

&lt;p&gt;The Model Context Protocol made this practical. A memory server is a small process your tools talk to over MCP, so Claude Code, Cursor and Copilot can all read and write the same store without custom plugins. The reference &lt;code&gt;memory&lt;/code&gt; server from the MCP project keeps a knowledge graph in a JSON file on disk. Open-source projects like Mem0 and Graphiti can run fully local too, with your own vector store underneath.&lt;/p&gt;

&lt;p&gt;What you get: one memory across tools, on your machine, with no account anywhere. What you don't get, out of the box: anything on your second laptop, anything for your teammate, backups, or a way to tell a stale note from a fresh one. It is memory for one person on one computer, and for a lot of developers that is exactly the right size.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Your own Postgres plus embeddings
&lt;/h3&gt;

&lt;p&gt;The serious version. Postgres with &lt;code&gt;pgvector&lt;/code&gt;, an embedding model running on Ollama so nothing leaves your network, a thin MCP server in front, and a job that watches git so notes tied to changed files get flagged. Now it works across machines and across people, because it's a service.&lt;/p&gt;

&lt;p&gt;That last word is the cost. You now own uptime, auth, backups, migrations, and the Saturday when the embedding model changes and every stored vector needs recomputing. None of it is hard. All of it is time you are not spending on the product you were trying to build. I know this because that service is, roughly, what I ended up building and hosting for other people.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Hosted
&lt;/h3&gt;

&lt;p&gt;You install an MCP server, point it at an account, and the storage, search, freshness checks and team access are someone else's job. That's ContextForge, and it's also Mem0's platform and a handful of others. The trade is obvious: your decisions live in a database you don't control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where ContextForge fits, and where it doesn't
&lt;/h2&gt;

&lt;p&gt;Here's the honest version, since the original draft of this post (written by a model, reviewed by me) claimed you could clone ContextForge and run it on your own server. You can't, and I'd rather correct that in public than let it stand.&lt;/p&gt;

&lt;p&gt;What you can do today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The MCP server (&lt;code&gt;contextforge-mcp&lt;/code&gt;, MIT) is open source. You can read every line of what runs on your machine.&lt;/li&gt;
&lt;li&gt;It gives one memory to Claude Code, Cursor, Copilot, Claude Desktop and Windsurf, with a free tier that's enough to find out whether it changes how you work.&lt;/li&gt;
&lt;li&gt;It does job three. Memories link to files and commits; when the code moves, the agent is told the note may be outdated and can confirm, correct or forget it.&lt;/li&gt;
&lt;li&gt;Git integration pulls commits and PRs in as context, so "why did we do this" has the diff next to it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What you can't do today:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run the backend yourself. Your memories are stored in our database. If your contract or your compliance team says project decisions cannot leave your network, ContextForge is the wrong tool for you right now, and option 2 or 3 above is the right one. I'd rather say that here than have you find out after setup.&lt;/li&gt;
&lt;li&gt;Bring your own embedding model. Search runs on our side.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Self-hosting is on my list. It isn't next, because the people writing to me are mostly stuck on jobs two and three, not on where the bytes live. If that's wrong for your case, tell me; those emails are how the list gets reordered.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to choose
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your situation&lt;/th&gt;
&lt;th&gt;Start with&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;One tool, one machine, you just want fewer repeated explanations&lt;/td&gt;
&lt;td&gt;Files in the repo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Several tools on the same laptop, nothing may leave the machine&lt;/td&gt;
&lt;td&gt;Local MCP memory server&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A team or several machines, and data residency is a hard rule&lt;/td&gt;
&lt;td&gt;Your own Postgres plus embeddings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A team or several machines, and you'd rather not run a service&lt;/td&gt;
&lt;td&gt;Hosted&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Whatever you pick, the thing that decides whether it works is not the storage. It's whether anyone writes to it. A memory nobody saves to is empty in every architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Is a vector database the same as agent memory?&lt;/strong&gt;&lt;br&gt;
No. It's the index. Memory also needs a write path the agent actually uses, metadata that ties notes to files and commits, and some way to detect staleness. Most self-hosted setups stop after the index.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I self-host ContextForge?&lt;/strong&gt;&lt;br&gt;
Not today. The MCP server is open source; the storage and search are hosted. If that rules it out for you, a local MCP memory server or Postgres with &lt;code&gt;pgvector&lt;/code&gt; will do the job with more work on your side.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does self-hosting make the memory more accurate?&lt;/strong&gt;&lt;br&gt;
Not by itself. Accuracy comes from what gets saved and whether stale notes get caught. Hosting changes who operates the system, not what it remembers.&lt;/p&gt;
&lt;h2&gt;
  
  
  If you want to try the hosted path
&lt;/h2&gt;

&lt;p&gt;One command, in the repo you're working on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It links the folder to a project so every agent in that repo shares the same memory, and adds the hooks that reload context after Claude Code compacts. Then, when something worth keeping happens, say it plainly: "Save to ContextForge: no automatic retries on the payment webhook, they double-charged customers." The next agent that touches that webhook, in whichever tool, will hear about it.&lt;/p&gt;

&lt;p&gt;And if your answer to the data question is "it has to stay here", go build option 3. It's a good weekend. Just budget for the Saturdays after it.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>selfhosted</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Shared Memory for Multiple AI Coding Agents (What They Already Share, and What They Don't)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Thu, 29 Oct 2026 17:45:57 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/shared-memory-for-multiple-ai-coding-agents-what-they-already-share-and-what-they-dont-3p7f</link>
      <guid>https://dev.to/alfredoizjr/shared-memory-for-multiple-ai-coding-agents-what-they-already-share-and-what-they-dont-3p7f</guid>
      <description>&lt;p&gt;This morning I watched two AI agents share a memory, and neither of them used the one I built.&lt;/p&gt;

&lt;p&gt;I was testing ContextForge's setup with a brand-new account. I asked Claude to remember a test decision: use GraphQL instead of REST for the API layer. Claude tried to search ContextForge first, got an error back, shrugged, and wrote the decision to its own built-in memory file instead. A few minutes later I opened a second session in the same folder. It found the decision right away. "This was already in my local memory," it said.&lt;/p&gt;

&lt;p&gt;So the two sessions did share a memory. It was a markdown file on my laptop.&lt;/p&gt;

&lt;p&gt;The error was ours. On an empty account, our search returned an error instead of an empty answer, and the fix for it had been sitting in the repo since July without ever being deployed. New users whose agent searched before saving had been hitting that same wall ever since. I deployed the fix today, ran the same test again, and this time the second session saved the decision to ContextForge too. But the detour taught me more about shared memory for multiple AI coding agents than anything I'd written about it before, so this post is about that.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Multiple agents" means four different things
&lt;/h2&gt;

&lt;p&gt;When people say they want shared memory across agents, they usually mean one of these. They don't share the same things.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setup&lt;/th&gt;
&lt;th&gt;What they already share&lt;/th&gt;
&lt;th&gt;What they don't&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Subagents inside one session&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Whatever the parent writes into each subagent's brief, and the results they hand back&lt;/td&gt;
&lt;td&gt;Anything the parent didn't think to pass down&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Two sessions of the same tool, same folder, same machine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The tool's built-in memory for that project (in Claude Code, a &lt;code&gt;MEMORY.md&lt;/code&gt; folder per project)&lt;/td&gt;
&lt;td&gt;What the other session is doing right now&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Different tools on the same repo&lt;/strong&gt; (Claude Code and Cursor, say)&lt;/td&gt;
&lt;td&gt;Nothing, except the files in the repo&lt;/td&gt;
&lt;td&gt;Every decision made in the other tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Your agent and a teammate's agent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Nothing, except what's committed&lt;/td&gt;
&lt;td&gt;Everything that lives in either person's tool or account&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first two rows are better than they were a year ago. Claude now keeps memory per project, Claude Code writes its own notes between sessions, and that's exactly what my second session picked up this morning. If you work alone, in one tool, on one machine, you may already have all the shared memory you need. I'd rather tell you that than sell you something.&lt;/p&gt;

&lt;p&gt;The last two rows are where it falls apart. Built-in memory lives inside one tool and one account. It doesn't cross into Cursor, it doesn't reach your other laptop, and it never reaches the person you work with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where shared memory actually breaks
&lt;/h2&gt;

&lt;p&gt;Running into this every day, I keep seeing the same three failures.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It crosses a boundary.&lt;/strong&gt; The decision was made in Claude Code; the next change happens in Cursor. Or on the other machine. Or in your teammate's session. The new agent has never heard of it and confidently does the opposite. I wrote about that pattern in &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;why AI coding agents contradict earlier decisions&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The reason gets dropped.&lt;/strong&gt; Most notes record &lt;em&gt;what&lt;/em&gt; was decided, not &lt;em&gt;why&lt;/em&gt;. "Use GraphQL" survives; the reason behind it (say, "the mobile screens needed a dozen REST calls each") doesn't. Without the why, the next agent re-opens the question the first time it looks inconvenient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The memory goes stale.&lt;/strong&gt; Someone renames the file the note talks about. The note doesn't know. Now every agent that reads it is working from a map of a building that has been remodeled. Static files like CLAUDE.md have the &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;same problem&lt;/a&gt;, just slower.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a shared memory needs to do
&lt;/h2&gt;

&lt;p&gt;After this morning, my list has four items instead of three.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One place every agent can reach.&lt;/strong&gt; Not a file inside one tool's config. Something Claude Code, Cursor, Copilot and Claude Desktop can all read and write. That's what MCP is for: one memory server, any client that speaks the protocol.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decisions with their reason attached.&lt;/strong&gt; Save "API layer uses GraphQL because the mobile screens needed a dozen REST calls each," not "GraphQL."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A way to notice when the code moved.&lt;/strong&gt; If a memory points at files, it should get flagged when those files change, so an agent confirms or corrects it instead of trusting it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It has to work on day one, when it's empty.&lt;/strong&gt; This is the one I learned today. When an agent has two memories available, it uses whichever one answers. If the shared one returns an error, or makes the agent work for an empty answer, the agent falls back to its private memory, and your "shared" memory never gets the first entry. A shared memory that fails on empty never stops being empty.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There's also a fifth thing that isn't memory at all: knowing what the &lt;em&gt;other&lt;/em&gt; agents are doing right now. Memory is history. If two sessions are about to edit the same module this minute, you need presence, not recall. I wrote about that separately in &lt;a href="https://contextforge.dev/blog/one-developer-five-terminals-zero-awareness" rel="noopener noreferrer"&gt;One Developer, Five Terminals, Zero Awareness&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I set it up
&lt;/h2&gt;

&lt;p&gt;I build &lt;a href="https://contextforge.dev" rel="noopener noreferrer"&gt;ContextForge&lt;/a&gt;, so this is the setup I use, with my bias stated up front. In Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add contextforge &lt;span class="nt"&gt;-s&lt;/span&gt; user &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;CONTEXTFORGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;your-key&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; npx &lt;span class="nt"&gt;-y&lt;/span&gt; contextforge-mcp
&lt;span class="nb"&gt;cd &lt;/span&gt;your-project &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;init&lt;/code&gt; links the folder to a project, so every agent working in that repo reads and writes the same memory, and it adds the rules that make sessions check who else is live before big changes. For Cursor, Copilot, Claude Desktop and Windsurf it's the same server added to that tool's MCP config; the &lt;a href="https://contextforge.dev" rel="noopener noreferrer"&gt;setup page&lt;/a&gt; now walks you through each one, because "add this to your MCP config" turned out to be where people got stuck.&lt;/p&gt;

&lt;p&gt;Then, when something worth keeping happens, say it plainly: "Save to ContextForge: we use GraphQL for the API layer because the mobile screens needed a dozen REST calls each." Naming the memory matters more than it should. Ask an assistant to "remember" something and it may reach for its built-in memory first, which is exactly what I watched happen this morning.&lt;/p&gt;

&lt;h2&gt;
  
  
  What it won't do
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It won't save things on its own judgment alone.&lt;/strong&gt; Agents save what they're asked to, plus what they decide is worth keeping. A memory nobody writes to stays empty.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It isn't a lock.&lt;/strong&gt; Presence tells one session another is on the auth module; it doesn't stop it from going there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It doesn't replace reading the code.&lt;/strong&gt; It tells the next agent what was decided and why. The code is still the truth for what &lt;em&gt;is&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you only ever run one tool on one machine, your built-in memory is probably enough, and you can skip all of this. If your agents cross tools, machines or people, they need one place to meet. Just make sure that place answers on day one.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>mcp</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Persistent Memory for Claude Desktop with MCP (Now That Claude Has Its Own)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Tue, 27 Oct 2026 16:12:59 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/persistent-memory-for-claude-desktop-with-mcp-now-that-claude-has-its-own-3b8e</link>
      <guid>https://dev.to/alfredoizjr/persistent-memory-for-claude-desktop-with-mcp-now-that-claude-has-its-own-3b8e</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/persistent-memory-for-claude-desktop-with-mcp" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I wrote the &lt;a href="https://contextforge.dev/blog/how-to-give-claude-persistent-memory-with-mcp" rel="noopener noreferrer"&gt;setup guide for giving Claude persistent memory over MCP&lt;/a&gt; in March, Claude Desktop had no memory of its own. You closed the window and that was it. That is no longer true. Claude now saves memories on its own, lets you read and edit them in Settings, and keeps a separate memory per project. So if you're searching for persistent memory for Claude Desktop with MCP today, the honest question isn't &lt;em&gt;how&lt;/em&gt; anymore. It's &lt;em&gt;whether&lt;/em&gt;, and for what.&lt;/p&gt;

&lt;p&gt;I build a memory server, so you'd expect me to say yes. The real answer is: it depends on what you need remembered. Here is what the built-in memory keeps, where it stops, and the two situations where memory over MCP earns its place next to it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Claude Desktop's own memory is about &lt;em&gt;you&lt;/em&gt;: topics, preferences, ongoing threads, saved as you chat and editable in Settings. It stays inside your Claude account. It does not reach Claude Code, Cursor, a teammate, or a repo, and it has no idea when the code it describes changed. If you only use Claude Desktop and you want it to remember you, turn it on and stop reading. If the thing you need remembered is a &lt;em&gt;project&lt;/em&gt; (decisions, reasons, the branch you were on) that other tools or people also touch, that's the job of a memory server over MCP, and you can run both.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What Claude Desktop remembers on its own
&lt;/h2&gt;

&lt;p&gt;The current memory feature, per &lt;a href="https://support.claude.com/en/articles/11817273" rel="noopener noreferrer"&gt;Anthropic's help center&lt;/a&gt;, works like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude saves memory as individual &lt;strong&gt;topics&lt;/strong&gt; while you chat, rather than summarizing afterwards. You can also say "remember this."&lt;/li&gt;
&lt;li&gt;Each &lt;strong&gt;project&lt;/strong&gt; has its own memory. In a project chat, Claude uses that project's memory plus your account memory, never another project's.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;read, edit and delete&lt;/strong&gt; every topic under Settings → Your Claude → Manage memory, or just tell Claude to change or forget something.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chat search&lt;/strong&gt; (paid plans) lets Claude look up earlier conversations when you ask. It shows up as a tool call and cites the chat it found.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Incognito&lt;/strong&gt; chats are never saved or searched. Sensitive topics are excluded by default.&lt;/li&gt;
&lt;li&gt;It's on by default for Free, Pro and Max on web, Desktop and mobile, as two toggles under Settings → Memory ("Search and reference chats" and "Generate memory from chats"). On Team and Enterprise an owner has to enable it, and owners cannot read members' memories.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is a real memory. It's better than what most people had in March, and for a lot of use it is enough. The limits only show up when you look at what it is &lt;em&gt;about&lt;/em&gt; and where it &lt;em&gt;lives&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it stops
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Claude Desktop built-in memory&lt;/th&gt;
&lt;th&gt;Memory over MCP (ContextForge or similar)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;What it remembers&lt;/td&gt;
&lt;td&gt;Topics about you and your ongoing conversations&lt;/td&gt;
&lt;td&gt;Whatever the agent saves: decisions with the reason, project facts, tasks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where it lives&lt;/td&gt;
&lt;td&gt;Inside your Claude account&lt;/td&gt;
&lt;td&gt;A server any MCP client can reach&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reaches Claude Code / Cursor&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, same memory from every tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reaches a teammate&lt;/td&gt;
&lt;td&gt;No (owners can't even see it)&lt;/td&gt;
&lt;td&gt;Yes, if you share the project&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tied to a repo or branch&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes, memories link to a project and the files they describe&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Knows when the code changed&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Freshness check flags memories whose files changed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How it's recalled&lt;/td&gt;
&lt;td&gt;Claude decides what's relevant&lt;/td&gt;
&lt;td&gt;The agent runs a search, or you ask "why did we…"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What a reset does&lt;/td&gt;
&lt;td&gt;Deletes everything, including project memories&lt;/td&gt;
&lt;td&gt;Export, snapshot, restore&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two rows matter more than the rest. &lt;strong&gt;Reach:&lt;/strong&gt; the built-in memory stops at the edge of the Claude app. The decision you made in Claude Desktop at 3 pm does not exist for Claude Code at 5 pm, and it never will, because the two don't share a store. &lt;strong&gt;Unit:&lt;/strong&gt; the built-in memory is organized around you. A memory server is organized around a project, which is where "why did we make the landing page static" needs to live if a fresh session is going to &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;stop contradicting it&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When the built-in memory is enough
&lt;/h2&gt;

&lt;p&gt;Be honest with yourself about this one, because adding a server you don't need is just another thing to maintain.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You use Claude Desktop and nothing else. No Claude Code, no Cursor, no API.&lt;/li&gt;
&lt;li&gt;What you want remembered is about you: how you like answers, what you're working on this month, the names of the things in your life.&lt;/li&gt;
&lt;li&gt;Nobody else needs to see it.&lt;/li&gt;
&lt;li&gt;No code is involved, or the code never changes under the memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If that's you, turn memory on, open Settings once to see what it saved, and you're done. I mean it.&lt;/p&gt;

&lt;h2&gt;
  
  
  When you need memory over MCP
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;You use more than one tool on the same project.&lt;/strong&gt; This is the big one. Claude Desktop for thinking, Claude Code for building, maybe Cursor for the UI. The built-in memory lives in the first one only. &lt;a href="https://contextforge.dev/blog/how-to-share-context-between-claude-code-and-cursor" rel="noopener noreferrer"&gt;Sharing context between Claude Code and Cursor&lt;/a&gt; is the same problem with different names.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The memory is about decisions, not preferences.&lt;/strong&gt; "We chose soft deletes because the audit log needs the rows" has to be findable from any session, with the reason attached, or it gets re-decided.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Someone else works on it.&lt;/strong&gt; A teammate's Claude has never heard of your Claude's memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The thing it describes changes.&lt;/strong&gt; A memory that says "we're on Prisma" is actively harmful two weeks after you moved off it. Claude's built-in topics don't know your code moved. A memory server that links memories to files can flag them when those files change, which is the whole point of &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;not letting your context go stale&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting it up in Claude Desktop
&lt;/h2&gt;

&lt;p&gt;This part is short because the March guide has the long version. Claude Desktop reads MCP servers from one JSON file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# macOS
~/Library/Application Support/Claude/claude_desktop_config.json
# Windows
%APPDATA%\Claude\claude_desktop_config.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the server and your API key, then quit Claude Desktop completely (Cmd + Q on macOS) and reopen it:&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;"mcpServers"&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;"contextforge"&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;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"args"&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;"-y"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"contextforge-mcp"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"env"&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;"CONTEXTFORGE_API_KEY"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"your-api-key-here"&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="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;One thing that changed since March: Claude Desktop honors the instructions an MCP server declares about itself. Since &lt;code&gt;contextforge-mcp&lt;/code&gt; 0.5.1 those instructions tell Claude to query memory before answering about a project and to save decisions as they happen, so on Desktop it gets used without you writing a system prompt for it. The &lt;code&gt;init&lt;/code&gt; command and the post-compaction hook from the Claude Code guides don't apply here; Desktop has no compaction event to hook.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running both, or just one
&lt;/h2&gt;

&lt;p&gt;Full disclosure: on my own Claude Desktop both memory toggles are off. Not because the feature is bad, but because everything I'd want remembered is about a project, and I'd rather have one place to check than two. That's a preference, not a rule.&lt;/p&gt;

&lt;p&gt;If you keep Claude's memory on, the two don't fight. Leave the built-in one for you. Point the project at the memory server. The one habit that makes it work is saying, once per project, something like: &lt;em&gt;decisions and project facts go to ContextForge; use chat memory for me.&lt;/em&gt; After that the division holds on its own, because the server's instructions already push project decisions its way.&lt;/p&gt;

&lt;p&gt;The honest caveat: you will occasionally get the same fact in both places. That's harmless. The harmful case is the opposite one, a decision that lives only in Desktop's memory and is invisible to the session that needed it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't fix
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Memory over MCP is only as good as what got saved. If the agent never recorded that the migration uses soft deletes, no search will invent it.&lt;/li&gt;
&lt;li&gt;It doesn't make Claude's built-in memory reach other tools. Nothing does; it's inside the account by design.&lt;/li&gt;
&lt;li&gt;It's a small team's product. Setup is one JSON block, but if you want the post-compaction recall that Claude Code gets, that's a Claude Code feature, not a Desktop one.&lt;/li&gt;
&lt;li&gt;None of this replaces reading your own code. It replaces re-explaining it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does Claude Desktop's memory work in Claude Code?&lt;/strong&gt;&lt;br&gt;
No. The help center describes it for web, Desktop and mobile. Claude Code has its own mechanisms (CLAUDE.md, auto-memory, &lt;code&gt;--resume&lt;/code&gt;) and they don't share a store with the app either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I see what the MCP memory saved, the way I can in Settings?&lt;/strong&gt;&lt;br&gt;
Yes. Every memory is an item in a space in the dashboard, with the title, content and the files it references. You can edit, correct or delete it there or by asking the agent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do I have to turn Claude's memory off to use a memory server?&lt;/strong&gt;&lt;br&gt;
No. They coexist. Keep the built-in one for yourself and use the server for the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  One thing to do today
&lt;/h2&gt;

&lt;p&gt;Open Settings → Your Claude → Manage memory and read what Claude saved about you this month. Then ask yourself one question: is anything in there a &lt;em&gt;project decision&lt;/em&gt; that Claude Code or a teammate would need tomorrow? If the answer is yes, that's the memory that needs to live somewhere both of them can reach.&lt;/p&gt;

</description>
      <category>claude</category>
      <category>ai</category>
      <category>mcp</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Stop Claude Code From Losing Context (2026)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Fri, 16 Oct 2026 15:18:21 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/how-to-stop-claude-code-from-losing-context-2026-30ib</link>
      <guid>https://dev.to/alfredoizjr/how-to-stop-claude-code-from-losing-context-2026-30ib</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/how-to-stop-claude-code-from-losing-context" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yesterday I was in the middle of a release with Claude Code. Two hours in, the session hit the context limit and compacted itself. In the old days that was the moment everything went sideways: the summary kept the gist, dropped the task, and the next answer started from "let's review the auth changes" when we had been shipping a hook for twenty minutes. This time I asked it what it still knew, and it quoted my first request of the session, the last one before the cut, and the five memories that mattered for the branch I was on.&lt;/p&gt;

&lt;p&gt;That difference is not luck. If you've been searching for how to stop Claude Code from losing context, here's the honest version: Claude Code loses context at four specific moments, and each one has a different fix. Some are a flag. One is a hook. None of them is "buy a bigger context window."&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Context gets lost when the window compacts, when you start a new session, when you switch tools, and when your CLAUDE.md is out of date. Keep rules in CLAUDE.md, resume sessions instead of restarting them, install a post-compaction hook that re-injects the task, and keep decisions in a memory the agent can query from any session. The table below says which fix covers which moment.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The four moments Claude Code loses context
&lt;/h2&gt;

&lt;p&gt;It helps to be precise about &lt;em&gt;when&lt;/em&gt; it happens, because people blame the model for all four and only one is really about the model.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Compaction.&lt;/strong&gt; The window fills, Claude Code summarizes the conversation to free space, and the summary is lossy. Decisions and the original task are the usual casualties. I wrote the long version in &lt;a href="https://contextforge.dev/blog/claude-code-compaction-why-your-session-forgets-mid-task-and-the-fix" rel="noopener noreferrer"&gt;why your session forgets mid-task&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A new session.&lt;/strong&gt; You close the terminal, come back tomorrow, type &lt;code&gt;claude&lt;/code&gt;, and it's a blank slate. Everything you explained lives in a transcript it isn't reading. The &lt;a href="https://contextforge.dev/blog/claude-code-session-handoff-how-to-resume-work" rel="noopener noreferrer"&gt;session handoff post&lt;/a&gt; covers the manual workarounds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A tool switch.&lt;/strong&gt; You move to Cursor for the UI work. Nothing from Claude Code follows you, because each tool keeps its own state. &lt;a href="https://contextforge.dev/blog/how-to-share-context-between-claude-code-and-cursor" rel="noopener noreferrer"&gt;Sharing context between Claude Code and Cursor&lt;/a&gt; is its own problem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A stale CLAUDE.md.&lt;/strong&gt; The file loads every session, which feels like memory until the codebase moves on and the file doesn't. Now the agent confidently follows rules that stopped being true in August. &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;Why CLAUDE.md goes stale&lt;/a&gt; has the pattern.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Within a single uncompacted session, by the way, Claude does remember what you said ten messages ago. That part works. The question of &lt;a href="https://contextforge.dev/blog/does-claude-remember-between-individual-chats-in-the-same-thread" rel="noopener noreferrer"&gt;whether Claude remembers between chats in the same thread&lt;/a&gt; is really about the four moments above.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which fix covers which moment
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Where context lives&lt;/th&gt;
&lt;th&gt;Survives compaction&lt;/th&gt;
&lt;th&gt;Survives a new session&lt;/th&gt;
&lt;th&gt;Survives a tool switch&lt;/th&gt;
&lt;th&gt;Where it breaks&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no (Cursor reads &lt;code&gt;.cursorrules&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;goes stale; nobody updates it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;claude --continue&lt;/code&gt; / &lt;code&gt;--resume&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;partly (the transcript is kept, the summary is what the model sees)&lt;/td&gt;
&lt;td&gt;yes, same machine only&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;a second machine, a teammate, a different tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Claude Code auto-memory notes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;one tool, one machine, the agent decides what to write&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A post-compaction hook&lt;/td&gt;
&lt;td&gt;yes, that's its job&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;no&lt;/td&gt;
&lt;td&gt;only Claude Code; only what the hook re-injects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory over MCP (ContextForge or similar)&lt;/td&gt;
&lt;td&gt;yes, if something re-injects it&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;yes&lt;/td&gt;
&lt;td&gt;only as good as what the agent saved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No single row covers everything. The combination that works for me is the first, fourth and fifth rows together, and the second row for the days I just need to pick up where I left off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 1: Put rules in CLAUDE.md, not facts
&lt;/h2&gt;

&lt;p&gt;CLAUDE.md is loaded on every session, so it's tempting to put everything there: the architecture, the decisions, the schema. Don't. Facts change and the file won't. Keep it for things that are true for the life of the project: how to run tests, what never to do, which tool holds the memory. Mine has one rule that matters more than the rest: &lt;em&gt;at the start of a session, query memory before answering anything about the project.&lt;/em&gt; That single line turns a static file into a pointer at something that stays current.&lt;/p&gt;

&lt;p&gt;If your CLAUDE.md is more than a screen long, that's the symptom. Move the facts somewhere with a date on them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 2: Resume, don't restart
&lt;/h2&gt;

&lt;p&gt;The cheapest fix most people skip. &lt;code&gt;claude --continue&lt;/code&gt; reopens the most recent session in the current directory; &lt;code&gt;claude --resume&lt;/code&gt; lets you pick one. The transcript comes back, including what you explained an hour ago. It doesn't help you on a second machine or in another tool, and it doesn't undo a compaction that already happened, but for "I closed the terminal to get coffee" it's the whole answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 3: Make compaction restore the task
&lt;/h2&gt;

&lt;p&gt;This is the moment that used to hurt most, and it's the one where a hook changes the outcome. Claude Code runs a &lt;code&gt;SessionStart&lt;/code&gt; hook with the matcher &lt;code&gt;compact&lt;/code&gt; right after every compaction, and whatever that hook prints is injected into the fresh context. I covered the mechanics and the setup in the &lt;a href="https://contextforge.dev/blog/claude-code-compaction-why-your-session-forgets-mid-task-and-the-fix" rel="noopener noreferrer"&gt;compaction post&lt;/a&gt;; the short version is two commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add contextforge &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;CONTEXTFORGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;your_key&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; npx &lt;span class="nt"&gt;-y&lt;/span&gt; contextforge-mcp
npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What's new since that post is the second hook &lt;code&gt;init&lt;/code&gt; now installs. A &lt;code&gt;UserPromptSubmit&lt;/code&gt; hook records each prompt you type to a local file, so when the recall hook runs after compaction it can print your session objective (the first real request) and the last request before the cut, ahead of the memories relevant to your branch, the project's recent memories and its pending tasks. The task itself, which is what the summary drops most often, is the first line the model sees.&lt;/p&gt;

&lt;p&gt;This is what came back after yesterday's compaction, trimmed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## ContextForge: context restored after compaction
Session objective (the user's first request): "ya esta areglado e implementado?"
Latest request before compaction: "ok dale arranca con el 13.2"
Relevant to current work:
- contextforge-mcp 0.13.1 shipped: staged recall deadlines ...
- ROOT CAUSE stale CONTEXTFORGE_API_KEY in Claude Code env ...
Recent memories: (10)
Pending tasks: (5)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two honest notes. The prompt log stays on your machine and is never uploaded; what leaves is the objective text, at most 600 characters, sent as a search query the same way any memory query is. And the hook never blocks a session: no key, no linked project, a slow network, and it prints nothing and exits.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fix 4: Keep decisions where any session can ask for them
&lt;/h2&gt;

&lt;p&gt;The hook only re-injects what exists. For a decision to come back next week, in Cursor, on your laptop, it has to be saved somewhere outside the transcript, with the reason attached. That's the part &lt;a href="https://contextforge.dev/blog/mcp-memory-server-how-to-give-claude-cursor-persistent-memory-2026" rel="noopener noreferrer"&gt;MCP memory&lt;/a&gt; does.&lt;/p&gt;

&lt;p&gt;One correction to how this usually gets described, including by the first draft of this post: nothing is captured silently. The agent calls a tool, &lt;code&gt;memory_ingest&lt;/code&gt;, with a title, the content and the space it belongs to. It does that on its own when the server's instructions tell it to save decisions proactively, and it does it when you say "remember this." Reading works the same way: &lt;code&gt;memory_query&lt;/code&gt; is a semantic search, so "why did we make the landing page static" finds the decision even if nobody used those words. Memories live in spaces (topics) inside a project linked to your repo, and a freshness check flags the ones that reference files that changed since, so the agent can confirm, correct or forget them instead of acting on a fact from August.&lt;/p&gt;

&lt;p&gt;If you want to see what that looks like when it fails, &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;why AI coding agents contradict earlier decisions&lt;/a&gt; is the companion piece: the decision was saved, but without the why.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this doesn't fix
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The hooks are Claude Code only. Cursor and Windsurf get the memory over MCP but not the post-compaction re-injection, because they don't expose that event.&lt;/li&gt;
&lt;li&gt;The objective is the first real prompt the hook logged. If you started the session with "hola" and then pasted a 2,000-word brief, the brief is what comes back, cut at 300 characters.&lt;/li&gt;
&lt;li&gt;The relevance search is one metered query per compaction. It only runs when there's an objective or you're on a non-default branch, and it has a six-second deadline so a slow search trims the block instead of erasing it.&lt;/li&gt;
&lt;li&gt;It's a small team's early product. Setup is one command, but the quality of what comes back is exactly the quality of what got saved. If the agent never recorded that the migration uses soft deletes, no search will invent it.&lt;/li&gt;
&lt;li&gt;None of this replaces reading the code. It replaces re-explaining it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does &lt;code&gt;/compact&lt;/code&gt; delete my context?&lt;/strong&gt;&lt;br&gt;
It replaces the conversation with a summary. The transcript on disk is intact, but the model only sees the summary, so anything the summary dropped is gone for the session unless a hook puts it back.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does CLAUDE.md load automatically?&lt;/strong&gt;&lt;br&gt;
Yes, at the start of every session in that directory, which is why it's the right place for rules and the wrong place for facts that change.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does the post-compaction hook work in Cursor?&lt;/strong&gt;&lt;br&gt;
No. Cursor has no compaction hook. Memory over MCP works there; the re-injection step doesn't.&lt;/p&gt;

&lt;h2&gt;
  
  
  One thing to do today
&lt;/h2&gt;

&lt;p&gt;Open &lt;code&gt;.claude/settings.json&lt;/code&gt; in the project you use most. If there's no &lt;code&gt;SessionStart&lt;/code&gt; entry with the matcher &lt;code&gt;compact&lt;/code&gt;, you're relying on the summary to remember your task. Run &lt;code&gt;npx contextforge-mcp init&lt;/code&gt;, work until the next compaction, and ask Claude what it still knows.&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>ai</category>
      <category>mcp</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why AI Coding Agents Contradict Earlier Decisions (and How to Stop It)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Thu, 15 Oct 2026 14:47:59 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/why-ai-coding-agents-contradict-earlier-decisions-and-how-to-stop-it-33hf</link>
      <guid>https://dev.to/alfredoizjr/why-ai-coding-agents-contradict-earlier-decisions-and-how-to-stop-it-33hf</guid>
      <description>&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://contextforge.dev/blog/why-ai-coding-agents-contradict-earlier-decisions" rel="noopener noreferrer"&gt;contextforge.dev&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two weeks ago Claude Code and I spent an afternoon on the ContextForge landing page. We decided it would be fully static, regenerated in the background, and that the live numbers would stream only in the admin. We measured it, it was faster, and I wrote the reasoning into the pull request. The following Tuesday a fresh session looked at the same page and proposed making it dynamic "so the stats are always fresh." Same model, same repo, opposite decision, delivered with total confidence.&lt;/p&gt;

&lt;p&gt;If you've searched for why AI coding agents contradict earlier decisions, you've had a Tuesday like that. Here's the honest answer, and it isn't the one I expected when I started digging.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; The agent isn't changing its mind. Either the decision never reached the session you're in, or it arrived stripped of the reason behind it. There are five ways that happens, and each one has a cheap fix. The expensive part is turning the fix into a habit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  It's not memory loss. It's missing input.
&lt;/h2&gt;

&lt;p&gt;A language model doesn't hold opinions between calls. Every answer is computed from what's in front of it right now: your prompt, the files it opened, the conversation so far. If a decision isn't in that input, the agent isn't ignoring it. It's reasoning from the code as it is today, and in the code as it is today, the dynamic version of my landing page looks perfectly sensible.&lt;/p&gt;

&lt;p&gt;So the frustrating question, "why does it keep contradicting me?", turns into a more useful one: "why wasn't the decision in its input?" I found five reasons. Here they are in the order I hit them.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The decision lives in a chat you closed
&lt;/h2&gt;

&lt;p&gt;The obvious one. You and the agent worked something out in a conversation, the conversation ended, and the next session started from nothing. Claude Code can reopen a past session with &lt;code&gt;--resume&lt;/code&gt;, and for the same machine and the same repo that's often enough. I wrote about where that stops in &lt;a href="https://contextforge.dev/blog/claude-code-session-handoff-how-to-resume-work" rel="noopener noreferrer"&gt;Claude Code session handoff&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; anything you'd be annoyed to explain twice, write down somewhere the next session will read before it starts working.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Compaction summarized it away
&lt;/h2&gt;

&lt;p&gt;This one bites inside a single session. When the context window fills up, Claude Code summarizes the conversation and continues from the summary. The summary keeps "we're working on the landing page." It drops "static, because streaming cost 40 ms and nobody needs live stats on a marketing page." Ten minutes later the agent is cheerfully proposing the thing you ruled out, and from inside the session there's no seam to notice. I dug into the mechanics in &lt;a href="https://contextforge.dev/blog/claude-code-compaction-why-your-session-forgets-mid-task-and-the-fix" rel="noopener noreferrer"&gt;why your session forgets mid-task&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; keep decisions outside the transcript and put them back after every compaction. Claude Code has a hook for exactly that moment.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. You switched tools
&lt;/h2&gt;

&lt;p&gt;Cursor in the morning, Claude Code in the afternoon, Copilot for the review. Each one has its own context, its own rules file, its own idea of your project. A decision made in one of them never visits the others. This is why the contradiction so often shows up as "but we agreed on this yesterday," when yesterday was a different tool. More on that in &lt;a href="https://contextforge.dev/blog/how-to-share-context-between-claude-code-and-cursor" rel="noopener noreferrer"&gt;how to share context between Claude Code and Cursor&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; one place every tool reads from, instead of one notes file per tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Your instructions file says one thing and the code says another
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;.cursor/rules&lt;/code&gt;, &lt;code&gt;copilot-instructions.md&lt;/code&gt;. You write them once, carefully, and then the code moves on without them. When the file says "we use library X" and the code has quietly migrated to Y, the agent has to pick a side, and it picks differently on different days. A stale instructions file is worse than none, because the agent trusts it. I've made this mistake enough times to write &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;why your CLAUDE.md goes stale&lt;/a&gt; about it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; treat rules files as living documents. Prune them when a decision changes, and date the decisions you keep there.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. You saved the what, not the why
&lt;/h2&gt;

&lt;p&gt;This is the sneaky one, and the one I see most. The commit says "remove cache layer." An agent reading that learns there was a cache and now there isn't. It does not learn that the cache added latency for nothing. So the next time it meets a slow endpoint it does what any good engineer would do: it adds a cache. It isn't contradicting you. It's following the only reasoning it can see.&lt;/p&gt;

&lt;p&gt;A decision without its reason is just a fact waiting to be overturned.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; one sentence of why, every time. "Removed the cache layer: it added 40 ms and nothing read it twice." That sentence is what stops the re-litigation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to keep a decision so the agent finds it again
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Place&lt;/th&gt;
&lt;th&gt;What it keeps well&lt;/th&gt;
&lt;th&gt;Where it fails&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Rules files (&lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;.cursor/rules&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Standing conventions, how to behave&lt;/td&gt;
&lt;td&gt;Drifts, no per-decision reasoning, one file per tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Git commits and PRs&lt;/td&gt;
&lt;td&gt;What changed and when&lt;/td&gt;
&lt;td&gt;The why is thin, and agents rarely read history unless told to&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ADRs in the repo&lt;/td&gt;
&lt;td&gt;The full reasoning&lt;/td&gt;
&lt;td&gt;Someone has to point the agent at them, and nobody updates them&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory over MCP (ContextForge and others)&lt;/td&gt;
&lt;td&gt;Decision plus reason plus date, searchable from any tool&lt;/td&gt;
&lt;td&gt;Only holds what was saved, and needs a one-time setup&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;None of these is wrong. The mistake is expecting a rules file to carry decisions, or a commit log to carry reasons.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I do now
&lt;/h2&gt;

&lt;p&gt;I built &lt;a href="https://contextforge.dev" rel="noopener noreferrer"&gt;ContextForge&lt;/a&gt; because I was losing this argument with my own agents several times a week. The idea is small: when we decide something, the agent saves the decision with the reason, in the project's memory. The next session, in Claude Code, Cursor or Copilot, loads that memory over MCP (Model Context Protocol) and can search it by meaning, so "landing page rendering" finds the static-page decision even if nobody used those words. After a compaction, a hook prints the latest decisions and open tasks back into the context. And when the code behind a memory changes, a freshness check flags it so the agent can confirm, correct or forget it instead of defending something that's no longer true.&lt;/p&gt;

&lt;p&gt;Setup is one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add contextforge &lt;span class="nt"&gt;-s&lt;/span&gt; user &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nv"&gt;CONTEXTFORGE_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;your-key &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--&lt;/span&gt; npx &lt;span class="nt"&gt;-y&lt;/span&gt; contextforge-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the honest part.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It only recalls what was saved.&lt;/strong&gt; The habit of saying "save that, with the why" is the real product. The tool just makes the habit cheap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It won't stop an agent from arguing.&lt;/strong&gt; It gives the agent the reason not to. That's usually enough, and sometimes the agent is right and the old decision deserves a second look.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A stale decision in memory gets defended faithfully.&lt;/strong&gt; Freshness checks catch the cases tied to code changes. They don't replace your judgment on the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's an early product from a small team.&lt;/strong&gt; It works for me every day. It still has rough edges, and I'd rather you hear that from me.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Would a bigger context window fix this?&lt;/strong&gt;&lt;br&gt;
No. A bigger window lets one session hold more, and it still ends when the session ends. Most of the five causes above happen between sessions or between tools. I wrote a longer answer in &lt;a href="https://contextforge.dev/blog/context-rot-bigger-windows-wont-save-you" rel="noopener noreferrer"&gt;bigger windows won't save you&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Doesn't Claude Code's auto-memory already handle this?&lt;/strong&gt;&lt;br&gt;
Partly. It's useful for the agent's own notes, and it stays on that machine, inside that tool. The moment you open Cursor or a laptop at home, it's not there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Should I just put every decision in CLAUDE.md?&lt;/strong&gt;&lt;br&gt;
It'll work for a while. Then the file grows until the agent stops honoring half of it, and you're back to cause number four. Keep conventions in the rules file and decisions, with their reasons, somewhere searchable.&lt;/p&gt;

&lt;h2&gt;
  
  
  One thing to do today
&lt;/h2&gt;

&lt;p&gt;Write down the last three decisions you made with an agent, each with a single sentence of why. Put them where the next session will read them: your rules file at minimum, a memory layer if you have one. Tomorrow, before you ask the agent to build anything, ask it "what did we decide about X?" If it answers correctly, you've just closed all five causes for that decision. Then do it for the next three.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>claudecode</category>
      <category>cursor</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Claude Code Compaction: Why Your Session Forgets Mid-Task (and the Fix)</title>
      <dc:creator>Alfredo Izquierdo</dc:creator>
      <pubDate>Thu, 24 Sep 2026 17:00:43 +0000</pubDate>
      <link>https://dev.to/alfredoizjr/claude-code-compaction-why-your-session-forgets-mid-task-and-the-fix-cef</link>
      <guid>https://dev.to/alfredoizjr/claude-code-compaction-why-your-session-forgets-mid-task-and-the-fix-cef</guid>
      <description>&lt;p&gt;Last week I published a piece about &lt;a href="https://contextforge.dev/blog/claude-code-session-handoff-how-to-resume-work" rel="noopener noreferrer"&gt;handing off a Claude Code session&lt;/a&gt; without re-explaining everything. A reader left a comment that stuck with me: "Compaction is the limit that actually bites." He was right, and I'd glossed over it. So this post is the one I should have written first.&lt;/p&gt;

&lt;p&gt;If you searched for "claude code compaction" because your session suddenly stopped knowing things it knew an hour ago, here's what's going on, what actually survives, and the small hook I shipped to fix the part that hurt me most.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; When a Claude Code session gets long, Claude summarizes the conversation to free space. The summary keeps the gist and drops the details, and the details are usually your decisions. You can't see what got cut. The fix is to keep decisions outside the conversation and put them back after every compaction. ContextForge 0.12.0 does that with a Claude Code hook that runs automatically.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What compaction actually does
&lt;/h2&gt;

&lt;p&gt;Every model has a context window, and a working session fills it fast: file reads, tool output, your back-and-forth. When Claude Code gets close to the limit, it compacts. It writes a summary of everything so far, throws away the original messages, and keeps going with the summary plus whatever hadn't been summarized yet. You can trigger it yourself with &lt;code&gt;/compact&lt;/code&gt;, and it also happens on its own when the window fills up.&lt;/p&gt;

&lt;p&gt;From the outside it looks harmless. The status line says "Compacted," the conversation continues, and Claude still sounds like it knows what you're doing. That's the trap.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you can't tell what you lost
&lt;/h2&gt;

&lt;p&gt;Here's the part my reader nailed. After a compaction you get the summary &lt;strong&gt;plus&lt;/strong&gt; the tail of messages that hadn't been folded in yet. Where that cut lands depends on the exact moment compaction fired. So no two resumes give you the same context, and from inside the session there's no seam to look for. The summary reads as complete.&lt;/p&gt;

&lt;p&gt;What actually falls out is predictable, though. Summaries are good at "we're refactoring the retry logic." They're bad at "retry logic goes in the client, not the handler, and we dropped the Redis layer because it added 40ms for nothing." The gist survives. The decisions evaporate. You find out when Claude cheerfully re-adds the caching layer you removed two hours ago.&lt;/p&gt;

&lt;h2&gt;
  
  
  What survives a compaction
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The gist of the task:&lt;/strong&gt; kept, as a summary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Recent messages (the tail):&lt;/strong&gt; kept verbatim, but which ones depends on timing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Specific decisions and their reasons:&lt;/strong&gt; usually gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool output and file contents you discussed:&lt;/strong&gt; gone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anything saved outside the conversation:&lt;/strong&gt; untouched.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last line is the whole strategy. &lt;code&gt;--resume&lt;/code&gt; won't help you here, because it brings back the same compacted transcript. &lt;code&gt;CLAUDE.md&lt;/code&gt; helps for the stable stuff, but it goes stale the moment your decisions move faster than you edit the file (I wrote about that in &lt;a href="https://contextforge.dev/blog/why-claude-md-goes-stale" rel="noopener noreferrer"&gt;Why Your CLAUDE.md Goes Stale&lt;/a&gt;). What you want is the handful of decisions, stored somewhere compaction can't reach, and reloaded the instant the cut happens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: a hook that runs after every /compact
&lt;/h2&gt;

&lt;p&gt;Claude Code has a hooks system, and one of the events is &lt;code&gt;SessionStart&lt;/code&gt; with a &lt;code&gt;compact&lt;/code&gt; matcher. Anything a command prints there gets added straight into Claude's context right after the summary. That is exactly the moment we need.&lt;/p&gt;

&lt;p&gt;So in ContextForge MCP 0.12.0, &lt;code&gt;init&lt;/code&gt; installs this into your project's &lt;code&gt;.claude/settings.json&lt;/code&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;"hooks"&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;"SessionStart"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"compact"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"hooks"&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="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx -y contextforge-mcp recall"&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="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="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;h2&gt;
  
  
  What the hook does after every /compact
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;recall&lt;/code&gt; is a new subcommand. It reads which project this folder is linked to, fetches the 10 most recent memories saved for that project and up to 5 pending tasks, and prints them as plain text. Claude Code appends that text to the context. From Claude's point of view, the decisions were never gone.&lt;/p&gt;

&lt;p&gt;Here's what it looks like in the terminal, right after a compaction:&lt;/p&gt;

&lt;p&gt;A few things I cared about while building it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It can never break your session.&lt;/strong&gt; No API key, no linked project, no network, or more than eight seconds: it prints nothing and exits cleanly. You'd never know it ran.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's a tool call, not magic.&lt;/strong&gt; The hook is a shell command. You can run &lt;code&gt;npx contextforge-mcp recall&lt;/code&gt; yourself from the project folder and see exactly what Claude will see.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It's fast.&lt;/strong&gt; About four seconds, most of it waiting on the network.&lt;/li&gt;
&lt;/ul&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%2F0fzaom2djfj7ajj5w1uz.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%2F0fzaom2djfj7ajj5w1uz.png" alt=" " width="800" height="507"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting it up
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;New to ContextForge?&lt;/strong&gt; Install the MCP server the usual way, then run this once in your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx contextforge-mcp init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That writes the memory rules to your &lt;code&gt;CLAUDE.md&lt;/code&gt; and, on Claude Code, adds the hook. Nothing else to configure. Full steps are in the &lt;a href="https://contextforge.dev/docs/compaction-recall" rel="noopener noreferrer"&gt;docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Already using it?&lt;/strong&gt; Update to 0.12.0 and re-run &lt;code&gt;init&lt;/code&gt; in each project. It's idempotent: it only adds what's missing and leaves your existing &lt;code&gt;settings.json&lt;/code&gt; and hooks alone.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx contextforge-mcp &lt;span class="nt"&gt;--version&lt;/span&gt;   &lt;span class="c"&gt;# should say 0.12.0 or newer&lt;/span&gt;
npx contextforge-mcp init        &lt;span class="c"&gt;# adds the hook, prints "already present" next time&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then test it: run &lt;code&gt;/compact&lt;/code&gt; in a session and ask "what context did you just receive?" If Claude quotes a block that starts with "ContextForge: context restored after compaction," you're set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where it falls short
&lt;/h2&gt;

&lt;p&gt;I'd rather you know this now than find out later.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It only brings back what was saved.&lt;/strong&gt; If nobody saved the decision, there's nothing to restore. The habit that does the real work is asking the agent to save decisions as you go, and "save where we are and what's next" before you close the terminal.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It still can't tell you what the summary dropped.&lt;/strong&gt; Nobody can. What it does is make that question matter less.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code only.&lt;/strong&gt; Cursor and Copilot don't have this hook system. The same saved memories are there when you open the project in those tools, but the automatic re-injection is a Claude Code feature.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Your project has to be linked.&lt;/strong&gt; The hook needs a &lt;code&gt;.contextforge&lt;/code&gt; file in the repo root to know which project's memories to fetch. Ask the agent to "link project" once and you're done.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does compaction happen without me asking?&lt;/strong&gt;&lt;br&gt;
Yes. Claude Code compacts automatically when the context window fills up, and you can trigger it manually with &lt;code&gt;/compact&lt;/code&gt;. Both fire the hook.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does this replace &lt;code&gt;--resume&lt;/code&gt;?&lt;/strong&gt;&lt;br&gt;
No. &lt;code&gt;--resume&lt;/code&gt; reopens a session on the same machine; use it. The hook covers what &lt;code&gt;--resume&lt;/code&gt; can't: the decisions that a compaction summarized away. They complement each other.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I see what the hook sends?&lt;/strong&gt;&lt;br&gt;
Run &lt;code&gt;npx contextforge-mcp recall&lt;/code&gt; from the project folder. It prints exactly the block Claude receives, or nothing if the project isn't linked or the API key can't be found.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why did the hook print nothing for me?&lt;/strong&gt;&lt;br&gt;
The usual causes: an old &lt;code&gt;CONTEXTFORGE_API_KEY&lt;/code&gt; exported in your shell that overrides the one in &lt;code&gt;~/.claude.json&lt;/code&gt;, an older global install of &lt;code&gt;contextforge-mcp&lt;/code&gt; shadowing &lt;code&gt;npx&lt;/code&gt;, or the project isn't linked yet. The docs have a short troubleshooting list.&lt;/p&gt;




&lt;p&gt;Compaction isn't a bug. It's the price of long sessions, and the alternative is a session that stops working. The mistake I made for months was treating the transcript as the thing worth keeping. It isn't. The decisions are. Keep those outside the conversation, hand them back at the right moment, and compaction becomes something you stop noticing.&lt;/p&gt;

&lt;p&gt;If you want to try it, &lt;a href="https://contextforge.dev" rel="noopener noreferrer"&gt;ContextForge&lt;/a&gt; has a free tier and the setup is three commands. And if you're the reader who left that comment: thank you. You were right.&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>compaction</category>
      <category>claude</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
