Should a coding agent remember for you, or should you search what it already did?

Published · Updated

Search, for most projects, and a small amount of hand-written memory on top. Memory is a summary somebody chose to keep, and it is only as good as that choice. Search runs over the full record of what the agent did, so it can answer questions nobody thought to write down. The cost is that you have to ask.

The rest of this page is a way to decide, with five questions you can answer in a few minutes.

Two different things get called memory

A memory feature writes a short note after or during a session and loads it at the start of the next one. Claude Code has CLAUDE.md that you write and an auto memory directory that it writes. Codex has an opt-in memories feature, and Copilot has stored repository facts. All of them compress a session into a few lines, and the compression is lossy on purpose.

Search leaves the sessions alone. The transcripts are already on disk, and search is an index plus a query over them. Nothing is summarized, so nothing is lost to the summary, but nothing arrives in the next session unless you or the agent go and look.

One r/ClaudeAI commenter, quoted secondhand and not checked against the thread, put the failure of the first approach well: "it remembered we discussed sqlite vs postgres, remembered the tradeoffs, but forgot we actually decided on sqlite. the issue is most memory systems store the conversation flow, not the resolution". A search for "sqlite" over the transcripts would have found the decision, because the decision is in the text. A summary written before the decision was made would not have it.

The five questions

Answer these for the project you have in mind. Count the answers that point the same way.

  1. Is the thing you want back a rule or a fact about the world? "Run migrations with make migrate, never alembic directly" is a rule, and a rule belongs in memory because the agent needs it every time without being asked. "We tried Redis for the queue in March and dropped it" is history, and history is search.
  2. Would you know the right words to search for? If you remember the library name, the error text or the file, search finds it in seconds. If you only remember that you had a conversation, you will not get far, and a curated note would have been the better place to keep it.
  3. How often does the agent need it? Things needed at the start of nearly every session should be loaded automatically. Things needed twice a quarter should not occupy context every day.
  4. What happens when it is wrong? A stale line in CLAUDE.md is read as an instruction. One Hacker News commenter, in HN thread 49508317, wrote "once there is one poisoned line of text it negatively affects everything else downstream". A search hit is old and visibly dated, so you read it with suspicion by default.
  5. Who maintains it? Memory you write by hand needs an owner. Memory the tool writes needs somebody to prune it. In HN item 50402212 one developer said they turned off automatic memory in every harness they used, and still deleted "95%" of the memories Claude Code created anyway. Search has no upkeep, because the index follows the transcripts.

If four or five answers say "rule, known words, every session, bad when wrong, nobody to maintain", write a short instruction file and stop. If most say "history, vague words, occasionally, harmless, nobody to maintain", search is the better first move.

What memory is good at

Memory wins on a small set of stable facts. The build command. The branch policy. The one directory the agent must not touch. These change rarely, are needed constantly, and are short enough that a person can read all of them in a minute. The guide to Claude Code memory between sessions lists the options and what each stores, so this page does not repeat that comparison.

The Claude Code docs say to keep each CLAUDE.md under 200 lines, and that the file is delivered to the model as context, not as an enforced rule (docs checked 2026-11-10). That is a good fit for five important lines and a poor fit for a project history.

What search is good at

Search wins on anything shaped like "when did we, why did we, what did that command do". Users describe the same failure in several forms: the agent keeps the code in view and loses the reasoning behind the decisions. Reasoning is mostly in the middle of long sessions, which no end-of-session note captures in full.

It also wins after compaction. When a long session is compacted, the detail that leaves the live context is still in the transcript on disk, as covered in what Claude Code loses when it compacts. A search over the transcripts brings back the exact wording, where a memory note brings back only what the agent judged worth keeping.

For the mechanics of searching, how to search past Claude Code conversations covers grep, jq and the indexed options, and the guides index lists the rest.

The case against search alone

Search does not help an agent that does not know it should look. A fresh session asks no questions about last month. If the project has a hard rule, an agent that has to discover it by searching will often skip the search and break the rule first.

Search also returns raw, uneven text. A transcript hit may contain a wrong turn that was later reversed, and nothing in the hit says so. You still have to read it and confirm against the code or Git history before acting on it.

Using both

The pattern that holds up is small. Keep a short instruction file for the rules. Leave history in the transcripts and make it searchable. When a search turns up a decision that keeps being needed, promote one line of it into the instruction file, with a date. Memory then stays short because it only contains what search proved was needed.

Sealkeep

Sealkeep indexes your Claude Code and Codex transcripts, and sealkeep search <query> --content queries the full text. sealkeep mcp install registers a local MCP server so the agent itself can run those searches. What it does not do is write curated facts or replace CLAUDE.md or AGENTS.md, so the short rules file in this article is still yours to write. Recalled text is labelled as untrusted historical data, so check it against Git before relying on it.

FAQ

Mostly not. Most memory servers store notes the model chose to save, which makes them memory with a different delivery route. A server that indexes the raw transcripts is search, whatever it is called.

Can I just turn memory off?

You can. Claude Code has autoMemoryEnabled, which you toggle in /memory, and the environment variable CLAUDE_CODE_DISABLE_AUTO_MEMORY=1 (docs checked 2026-11-10). Your hand-written CLAUDE.md still loads.

How much does searching cost in tokens?

Only what you read. A search returns a handful of snippets, and nothing loads until you ask. A memory file costs its full length at the start of every session.

Do I need an index, or is grep enough?

Grep is enough for a few weeks of one project. Past that, an index saves time, and the comparison is in the search guide linked above.