{"slug": "your-agent-remembered-the-old-number-how-to-correct-what-it-remembers", "title": "Your Agent Remembered the Old Number. How to Correct What It Remembers", "summary": "A developer published a guide on correcting stale facts in AI agent memory, explaining that a correction typically adds a new fact without removing the old one, which can persist across multiple storage locations. The writeup maps where memory lives in Claude Code (CLAUDE.md files plus auto memory under ~/.claude/projects/<project>/memory/), ChatGPT (saved memories, past chats, custom instructions, files and connected apps) and Gemini CLI (GEMINI.md files and per-project folders), and offers a read-only Python script that scans Markdown memory files for old and new values and reports each file's modified timestamp.", "body_md": "Two months ago the public API allowed 100 requests per minute. Then the limit dropped to 60, you told your agent, and it said it would remember. Today it sizes a retry loop for 100 again.\n\nThe agent didn't ignore you. Most likely it now remembers both numbers. A correction usually adds a new fact. It doesn't always remove the old one, and the old one can live in several places at once.\n\nThis article is about that cleanup: where a remembered fact actually lives, how to find every copy of it, and how to correct or expire it so it stops coming back. An earlier article covered [how to scope memory and when to forget](https://dev.to/promptmaster/your-agents-memory-needs-a-scope-what-to-keep-where-and-when-to-forget-3hfh). This one starts after the damage is done: a wrong fact is already stored.\n\nBefore you can correct a memory, you need to know where it is. Three tools document this clearly.\n\n**Claude Code** keeps two kinds of memory. `CLAUDE.md` files are instructions you write. Auto memory is notes Claude writes itself, and the [memory docs](https://code.claude.com/docs/en/memory) list `feedback` (\"corrections you give Claude and approaches you confirm\") as one of the note types. Each project gets a folder at `~/.claude/projects/<project>/memory/` with a `MEMORY.md` index and one topic file per memory. The first 200 lines or 25KB of `MEMORY.md` load at session start, and topic files are read on demand.\n\nTwo details matter for stale facts. First, `CLAUDE.md` files are \"concatenated into context rather than overriding each other\". Second, the docs warn that \"if two instructions contradict each other, Claude may pick one arbitrarily.\" That warning is about instruction files, but my reading is that the same risk applies when the old number sits in `CLAUDE.md` and the correction sits in auto memory: both reach the model, and nothing guarantees which one wins.\n\n**ChatGPT** spreads memory over several sources. OpenAI's [Memory in ChatGPT](https://help.openai.com/en/articles/8590148-memory-faq) help page lists past chats, saved memories, custom instructions, saved files and connected apps, depending on plan and region. Saved memories \"are stored separately from chat history\", and the page says plainly: \"Deleting a chat alone does not necessarily delete a separate saved memory created from that chat.\"\n\n**Gemini CLI** stores memory as Markdown. Its [memory tool docs](https://geminicli.com/docs/tools/memory/) say it routes facts to repository `GEMINI.md` files, a private per-project memory folder, or the global `~/.gemini/GEMINI.md`.\n\nThe pattern is the same everywhere: one fact, several possible homes. A correction you type in chat lands in one of them.\n\nStart with the tool's own view, not your guess.\n\n`/memory`. It lists your `CLAUDE.md` and `CLAUDE.local.md` locations and lets you open the auto memory folder. The docs put it simply: \"Everything is plain markdown you can read, edit, or delete.\"`/memory show`. The For file-based memory, the inspection can be scripted.\n\nThis small script searches Markdown memory files for an old value and a new value, and prints every line that holds either one. If a file has frontmatter with a `modified` timestamp, the script also prints its age. Claude Code records that field: according to the docs, when Claude writes a memory file that begins with YAML frontmatter, Claude Code adds `modified` as an ISO 8601 timestamp. The script only reads files and uses only the Python standard library.\n\n``` bash\n#!/usr/bin/env python3\n\"\"\"Find every place a remembered fact still lives in markdown memory files.\nReads only. Usage: python3 find_fact.py OLD_PATTERN NEW_PATTERN DIR [DIR ...]\"\"\"\nimport re, sys\nfrom datetime import datetime, timezone\nfrom pathlib import Path\n\nold_pat, new_pat, dirs = sys.argv[1], sys.argv[2], sys.argv[3:]\nold_re, new_re = re.compile(old_pat, re.I), re.compile(new_pat, re.I)\nnow = datetime.now(timezone.utc)\n\ndef frontmatter(text):\n    m = re.match(r\"---\\n(.*?)\\n---\\n\", text, re.S)\n    return dict(re.findall(r\"^(\\w+):\\s*(.+)$\", m.group(1), re.M)) if m else {}\n\nold_hits = new_hits = 0\nfor d in dirs:\n    for f in sorted(Path(d).rglob(\"*.md\")):\n        text = f.read_text()\n        meta = frontmatter(text)\n        age = \"\"\n        if \"modified\" in meta:\n            mod = datetime.fromisoformat(meta[\"modified\"].replace(\"Z\", \"+00:00\"))\n            age = f\" (type={meta.get('type', '?')}, modified {mod:%Y-%m-%d}, {(now - mod).days} days ago)\"\n        for no, line in enumerate(text.splitlines(), 1):\n            if old_re.search(line):\n                old_hits += 1\n                print(f\"OLD  {f}:{no}{age}\\n     {line.strip()}\")\n            elif new_re.search(line):\n                new_hits += 1\n                print(f\"new  {f}:{no}{age}\\n     {line.strip()}\")\n\nprint(f\"{old_hits} line(s) with the old value, {new_hits} with the new one\")\nif old_hits and new_hits:\n    print(\"CONFLICT: both values are still stored. Fix or delete the OLD lines.\")\nsys.exit(1 if old_hits else 0)\n```\n\nI built a small demo to test it: a repo with a `CLAUDE.md`, and a memory folder laid out the way the Claude Code docs describe it (a `MEMORY.md` index plus topic files with `type` and `modified` frontmatter). I wrote the memory files by hand to match that layout; they are not a real Claude Code memory. The demo has the situation from the intro: the old limit in two places, the correction in another. This is the real output, run on 23 Nov 2026 with Python 3.13.5:\n\n``` bash\n$ python3 find_fact.py \"100 requests\" \"60 requests\" repo home/.claude/projects/demo-repo/memory\nOLD  repo/CLAUDE.md:4\n     - The public API rate limit is 100 requests per minute per key\nOLD  home/.claude/projects/demo-repo/memory/MEMORY.md:1\n     - [Rate limit](project_rate_limit.md): public API allows 100 requests/minute\nnew  home/.claude/projects/demo-repo/memory/MEMORY.md:2\n     - [Rate limit fix](feedback_rate_limit.md): user corrected the limit to 60 requests per minute\nnew  home/.claude/projects/demo-repo/memory/feedback_rate_limit.md:5 (type=feedback, modified 2026-11-18, 4 days ago)\n     User corrected me: the public API rate limit is now 60 requests per minute per key.\nOLD  home/.claude/projects/demo-repo/memory/project_rate_limit.md:5 (type=project, modified 2026-09-14, 69 days ago)\n     The public API rate limit is 100 requests per minute per key. Use it when sizing retries.\n3 line(s) with the old value, 2 with the new one\nCONFLICT: both values are still stored. Fix or delete the OLD lines.\nexit code: 1\n```\n\nThree copies of the old value. The correction exists, but the 69-day-old `project` note and the line in `CLAUDE.md` still say 100. The index lists both notes, so the old number loads at session start next to the new one.\n\nTelling the agent \"that's wrong\" is a good start, but it only fixes the place the agent chooses to write. Fix each copy where it lives:\n\n`MEMORY.md` line that points to it. In the demo, the old `project` note was deleted and the two index lines were merged into one.\nHere is the fix in the demo:\n\n```\n-- [Rate limit](project_rate_limit.md): public API allows 100 requests/minute\n-- [Rate limit fix](feedback_rate_limit.md): user corrected the limit to 60 requests per minute\n+- [Rate limit](feedback_rate_limit.md): public API limit is 60 requests per minute (corrected by user)\n - [Test runner](feedback_testing.md): use pnpm, never npm\nOnly in demo/home/.claude/projects/demo-repo/memory: project_rate_limit.md\n-- The public API rate limit is 100 requests per minute per key\n+- The public API rate limit is 60 requests per minute per key (changed Nov 2026)\n```\n\nAnd the same search afterwards:\n\n``` bash\n$ python3 find_fact.py \"100 requests\" \"60 requests\" repo home/.claude/projects/demo-repo/memory\nnew  repo/CLAUDE.md:4\n     - The public API rate limit is 60 requests per minute per key (changed Nov 2026)\nnew  home/.claude/projects/demo-repo/memory/MEMORY.md:1\n     - [Rate limit](feedback_rate_limit.md): public API limit is 60 requests per minute (corrected by user)\nnew  home/.claude/projects/demo-repo/memory/feedback_rate_limit.md:5 (type=feedback, modified 2026-11-18, 4 days ago)\n     User corrected me: the public API rate limit is now 60 requests per minute per key.\n0 line(s) with the old value, 3 with the new one\nexit code: 0\n```\n\nOne value left, in every place.\n\nSome facts change: limits, prices, versions, owners, deadlines. For those, my own rule (not something the docs require) is to write the date into the fact itself, like \"(changed Nov 2026)\" above. Then a reader, human or agent, can tell how current it is without opening a settings screen. Claude Code's `modified` timestamp does part of this for auto memory, but it records when the file was written, not whether the fact is still true.\n\nIt also helps to know what is *not* cleaned up for you. The Claude Code docs say memory files are excluded from the transcript retention sweep and \"stay until you or Claude edits or deletes them\". For your `CLAUDE.md` files and rules, `/doctor prompt-audit` asks Claude to look for outdated or conflicting instructions and propose edits; nothing changes until you ask Claude to apply them. In ChatGPT, the help page notes that deletion and memory updates \"can take time\" to propagate.\n\n`/memory reload`, which re-scans the `GEMINI.md` files.\nIf you want the basics behind all this, the free [AI Agent Memory Quick-Start](https://promptmasterstore.gumroad.com/l/agentmemoryfree?utm_source=devto) explains the four kinds of memory and the memory loop (extract, store, retrieve, use, maintain), including consolidation and forgetting, in 6 pages. For the four kinds of memory in article form, see [Why Your AI Agent Forgets Everything](https://dev.to/promptmaster/why-your-ai-agent-forgets-everything-and-the-4-kinds-of-memory-that-fix-it-5553).\n\nNow I'd like to hear from you: what has your agent remembered wrong, and where did the old value turn out to live?\n\n*This article was written with the assistance of AI and reviewed by the author.*", "url": "https://wpnews.pro/news/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers", "canonical_source": "https://dev.to/promptmaster/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers-1fce", "published_at": "2026-11-25 10:35:10+00:00", "updated_at": "2026-11-25 10:43:22.307083+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "developer-tools"], "entities": ["Claude Code", "Anthropic", "ChatGPT", "OpenAI", "Gemini CLI", "Google"], "also_reported_by": [], "takeaway": "A correction usually adds a new fact rather than replacing the old one, so stale values persist across CLAUDE.md, auto memory, saved ChatGPT memories and GEMINI.md files; grep all Markdown memory locations for both old and new values and check each file's modified timestamp before trusting a fix.", "recommendation": {"advice": "After correcting an agent's remembered fact, grep every Markdown memory location for both the old and new values and delete or expire the stale copies rather than assuming the correction replaced them.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers", "markdown": "https://wpnews.pro/news/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers.md", "text": "https://wpnews.pro/news/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers.txt", "jsonld": "https://wpnews.pro/news/your-agent-remembered-the-old-number-how-to-correct-what-it-remembers.jsonld"}}