Skip to content

Productupdated 5 min read

Why your AI agents keep forgetting things

Each agent starts from zero. Decisions made in one session vanish in the next. Here's how shared memory fixes that, and the four MCP calls that carry a decision into the next session.

Card: Rejected last week. Back in the code. Next to the title, the scene: Claude Code wires a retry the reviewer rejected; Cursor picks a pool size changed on purpose; Codex rebuilds a migration already dropped; each session starts from zero. On the left, a dark window with the four MCP calls of every agent turn: memory_prepare when the turn starts, with memories, keyed facts and open handoffs; memory_retrieve only if prepare was not enough; memory_store with the decision and the options rejected; memory_used with the memories that carried the answer. A green arrow runs from the end of the loop back to the first call: the next session, on any harness, gets the decision before it writes a line. On the right, an illustrative example of what memory_prepare hands the next session for the ask “Add retry to the webhook sender”: the owner’s decision of 2026-11-20, webhook retries capped at 3 with exponential backoff, with infinite retry and retry in the caller marked as rejected; the keyed fact webhooks.retry.max = 3 as of 2026-11-20; and the rule that higher authority wins: human, then designated, then import, then agent. In the bottom band, the checklist: prepare at every turn; decisions with the options rejected; changing values as keyed facts; check memory_used. In the footer, the guide covers hooks for Claude Code, Codex, Cursor, Kiro and Gemini CLI.

Your Claude Code session ends. Tomorrow, Cursor starts fresh. The reason you picked PostgreSQL over MongoDB? Gone. The API design your team agreed on last week? Nobody remembers the details.

This is the default state for teams using AI coding agents. Every session is isolated. Every agent is a blank slate.

The cost of forgetting

It adds up fast. Someone spends the start of every session re-explaining context to Cursor. Someone else re-derives a decision that was already made in a Claude Code session last Tuesday. A third person asks Slack "did we ever decide on X?" and gets three different answers.

Put more than one agent on the same team and the pattern shows up in the code. Claude Code wires back a retry the reviewer rejected last week. Cursor picks a Postgres pool size that was changed on purpose. Codex rebuilds a migration someone already dropped. The model didn't make a mistake in any of the three: the decision just wasn't anywhere it could see.

The problem isn't that AI agents are bad at remembering. They don't share memory at all.

What shared memory looks like

ValorBrain gives every agent on your team access to the same memory. When Claude Code stores a decision about your auth architecture, Cursor can read it five minutes later. When Kiro finds out that staging runs a different DB schema, that knowledge sticks.

It works over MCP (Model Context Protocol). Each agent connects to ValorBrain as an MCP server and reads and writes through the same tools. Everything is tenant-isolated.

Four calls per turn

What carries a decision into the next session is a short loop, the same on every agent turn:

  1. memory_prepare when the turn starts, with the user's message. It returns the relevant memories, the current keyed facts and the open handoffs.
  2. memory_retrieve only when prepare wasn't enough, with a clear question.
  3. memory_store when something gets decided: the decision, the options rejected and why.
  4. memory_used at the end, with the memories that actually carried the answer.

The card at the top of this post shows the loop with an illustrative example from the guide: the owner caps webhook retries at 3 with exponential backoff, and infinite retry and retry in the caller are recorded as rejected. In the next session, on any harness, the agent gets that decision in the memory_prepare result before it writes a line.

Two things matter. Store the rejected options, not just the conclusion: without them, the next agent can't tell whether a new situation should reopen the decision. And a value that changes (a limit, an owner, a deploy target) becomes a keyed fact with a date and an authority, like webhooks.retry.max = 3 as of 2026-11-20. A newer value replaces the old one unless the old one came from a higher authority. In that case the agent's write stays a proposal until a person approves it.

On harnesses with hooks, memory_prepare can run on its own. On Claude Code, Codex, Kiro and Gemini CLI it runs at every prompt. On Cursor it runs only at session start, because Cursor's before-prompt hook can't add context. Read what the hook sends before you turn it on: on the first four, each turn's prompt goes to the memory engine, and you can switch that off. Without hooks, nothing forces the agent to call memory_prepare. Put the loop in the project's rules file (CLAUDE.md, AGENTS.md, .cursor/rules) and watch memory_used to see whether it's followed.

The step-by-step, with the command for each harness, is in the guide Shared memory for multi-agent teams over MCP.

What changes in practice

  1. Less repeated work. The agent picks up where the last session stopped instead of hearing everything again.
  2. Fewer contradictions. The decision lives in the memory every agent reads, so the agent that wasn't in the conversation gets the same answer as the one that was.
  3. Faster onboarding. New team members, human or AI, query the memory instead of interrupting the people who've been around longer.

That's what the mechanism allows, not a measurement. To find out whether it's happening on your team, look at memory_used: memory no answer ever used is noise.

Next step

Less starting over. More continuity

Bring a real project. In one conversation we map where context gets lost between the people and agents on your team, and where to start.

Start with a project