· Haimantika Mitra

Why Your Coding Agent Keeps Forgetting, and Why More Memory Won’t Fix It

Engineering

If you've run Claude Code, Cursor or Copilot for a long session, you've probably seen the context window filling up. AI tools "compact" the chat into a short summary… and then your agent forgets the context you gave in the first place. Many articles have been published about how rules are ignored after every compaction, banned commit habits keep coming back, hours of setup summarized away in Cursor, and how a three-hour refactor plan was lost altogether.

In this article, we'll look at why this happens and how to fix it.

TL;DR: The solution is giving your agent a record of what exactly happened, not just a summary of what it thinks happened.

Why Does My Coding Agent Forget After Compaction?

Compaction and memory might sound like similar features, but they’re actually distinct approaches to context.

Compaction happens inside one long session. When the context window fills up, the tool asks the model to summarize the conversation so far and swaps the older messages for that summary. From then on, your agent works from the summary.

Memory is what carries over from one session to the next. Claude and ChatGPT have their own memory features, separate from compaction, and Anthropic describes agent memory as its own layer. Chat memory is mostly a general profile of you, updated in the background, and you have little say over what’s kept or dropped.

Summaries have their own limitations:

  • Important and intricate details are omitted.
  • It sometimes hallucinates things that never happened, making it impossible for the agent to tell the difference later.
  • Each compaction summarizes from the previous summary. Every mistake gets copied forward, and more detail is lost each round.

Why Doesn't a Bigger Context Window or Memory File Fix It?

That's why a bigger context window or a longer memory file doesn't fix the problem, because your agent is still reading a summary. At best, the summaries may be generated less frequently, reducing the recursive loss of detail. Bigger windows have their own problem: Chroma tested 18 models and found they get less reliable as the input gets longer, even on simple tasks.

These findings have been repeated across research papers, which have identified additional problems with compaction that compound over time. Namely: compaction drops your rules first. In tests with four frontier models, each summary lost more of the agent's rules, up to 2.65 of 3 after 30 compactions. "Don't touch this" instructions were dropped about 6 times more often than feature requests.

But there’s a light at the end of the tunnel. Research also finds that real conversations beat summaries.

This is why we created Continuous Memory.

What Is Continuous Memory?

Continuous Memory gives your coding agent a memory that carries forward from one session to the next, built from what really happened and not summaries. Think of it this way: CI brings code together. CD ships it. Continuous Memory carries the understanding forward.

It's built on two open-source, local-first plugins for the Entire CLI: entire-graph, which maps how your code fits together, and entire-brain, an MIT-licensed memory plugin that connects your agent sessions to that map. Before your agent starts a task, it can look up the decisions behind your code, see what was tried before, and check where each fact came from.

Here’s How It Works

  1. Entire records your sessions: Enable Entire in your repo to save each agent session. It works with Claude Code, Codex, Cursor, Copilot CLI, Gemini CLI, OpenCode, Factory Droid and Pi, and you can add others with an external agent plugin. Sessions are stored as-is in Git and linked to your commits through checkpoints.
  2. entire-graph maps your code: It maps how your code fits together, so that your agent can find the right code without reading everything.
  3. entire-brain builds the memory: It indexes your stored sessions and attaches them to the graph, so every decision is tied to the code it shaped. It also reads your Git history and docs, including PDF, Word, Excel and PowerPoint files in your docs/ folder. It reads sessions straight from Git, so the original is always the source of truth.
  4. Every memory pulls out facts that link to proof: From past sessions it saves facts like "retries are capped at 3, the 4th failure must page someone." Every fact links back to the session, commit, or file it came from. Run to check that those links still match your code.
  5. Your agent asks before it starts: hands the agent a short packet of past decisions, earlier attempts, relevant code, and tests to run, before it writes a line.

How Is Continuous Memory Different from CLAUDE.md, Memory Files and Mem0?

Most agent memory today follows one of these approaches. Here's how they compare:

ApproachWhat it keepsCan you check it against the source?Shared with your team?
Compaction summaryA model's summary; the original chat is thrown awayNoNo
CLAUDE.md / AGENTS.mdRules you write by handOnly what you wroteYes, if committed
Agent memory filesNotes the agent writes about past workNoUsually not
Vector memory layers (e.g. Mem0)Facts or embeddings extracted from past chatsVaries by toolVaries by tool
Continuous Memory (entire-graph + entire-brain)Full sessions linked to commits and mapped to your code, plus facts that point back to themYes, with Yes

Continuous Memory doesn't replace CLAUDE.md. The setup adds instructions to your CLAUDE.md and AGENTS.md so your agent knows when to ask entire-brain.

How We Tested It

We gave an agent a task where the right answer existed only in an old session, not in the code. Without entire-brain, it passed 0 of 5 runs. With entire-brain, it passed 5 of 5 by finding the decision in history and restoring it (benchmarks). This is how actual memory outpaces compaction. Instead of reinventing the wheel in each new session, entire-brain looks for the answer and preserves it for the future, so lessons learned aren't immediately forgotten.

Here’s How You Can Get Started in a Few Minutes

$# 1. Install the Entire CLI
curl -fsSL https://entire.com/install.sh | bash

# 2. Install entire-brain and entire-graph
curl -fsSL https://raw.githubusercontent.com/entireio/entire-brain/main/scripts/get-brain.sh | bash
entire plugin install graph

# 3. Record your agent's sessions (example: Codex)
entire enable -y --agent codex

# 4. Build your repo's brain
entire brain setup

# 5. Before a task, see what your agent should know
entire brain brief "change the retry policy"

Frequently Asked Questions

What is Continuous Memory, in short?

Continuous Memory is Entire's approach to agent memory: your repository and its recorded sessions become the memory your agent needs. Entire stores your agent sessions, entire-graph maps your code, and entire-brain connects the two so your agent can look up past decisions before it starts a task.

How do I stop Claude Code from forgetting my rules after compaction?

Don't rely on the compaction summary to carry your rules and decisions. Record your sessions with Entire and add entire-brain. Before a task, gives your agent the past decisions that apply, each linked to the session it came from, so the agent can look them up again any time, including after compaction.

Which coding agents does it work with?

Entire records sessions from Claude Code, Codex, Cursor, Copilot CLI, Gemini CLI, OpenCode, Factory Droid and Pi, and you can add other agents with an external agent plugin. entire-brain uses those recorded sessions, and setup adds instructions to AGENTS.md and CLAUDE.md so your agent knows how to use it.

Does it send my code or sessions to the cloud?

Not by default. entire-brain runs on your machine, and hosted memory sync is opt-in. Fact extraction uses a model; to skip it, run . Entire also redacts secrets when it saves sessions.

Try It Yourself

Next time your agent forgets something, don't reach for a bigger memory file. Give it the real history, so that it can find what actually matters.

Install the Entire CLI, turn it on for your agent, and work the way you normally do. When you want every new session to start with the decisions behind your code, add Continuous Memory with entire-graph and entire-brain. You can always tell us what you thought of it by joining our Discord today.