I fixed the official MCP and A2A SDKs. It changed how I build memory for agents

Over the past year agents learned two important things. Through MCP they call tools: read files, query databases, hit APIs. Through A2A they talk to each other: one agent sets a task, another does it and hands back the result.

But there is one thing they still can’t do. Every new conversation, an agent starts from a blank page. Yesterday it spent half an hour figuring out why the build fails, found the cause, fixed it. Today the same error shows up, and it spends another half hour.

I thought it was a configuration problem. Then for several months I wrote code for the protocols themselves: fixes in the official Go SDK for MCP, session locking in the PHP SDK, patches to a2a-go, my own A2A SDK for PHP. And I understood that this is not about configuration. There is no memory in the protocols themselves. That is correct. But then memory has to be built separately, and by different rules.

Below is what I saw in the code, and the three rules I took from it.

What I saw in the MCP code

MCP carries calls. The client tells the server: call this tool with these arguments. The server answers. That’s all.

The protocol has a session, and at first it looks like that is the memory. It is not. A session is transport: who connected, which requests are still waiting for an answer, what the client told about itself. One bug I fixed in the PHP SDK shows this well.

In PHP a server often runs under PHP-FPM, and requests from one session arrive in parallel, in different processes. On connect, the agent immediately sends tools/list and resources/list. Or it calls several tools at once. Each process reads the session, changes it and writes the whole thing back. Whoever writes last wins. The changes of the other process just vanish.

First, responses were removed from the session (that was a separate fix, php-sdk#535, merged on October 9, 2026). Then I added a lock per session: a process takes the lock before reading and releases it after writing. On one machine that is flock() on a file. On several machines it is a lock through symfony/lock in Redis or in a database. It is off by default and turns on with one line (php-sdk#584, merged on October 14, 2026).

$server = Server::builder()
    ->setSession(new FileSessionStore(__DIR__.'/sessions'))
    ->setSessionLock(new FileSessionLock(__DIR__.'/sessions'))
    ->build();

The conclusion from this story is simple. Even the state of a single connection is hard for a protocol to keep. If you also put the agent’s long-term memory there, it will break the same way: the last write will wipe out the previous one.

The second story is from the Go SDK. The client cached the result of resources/read under one key: the resource address. But MCP has retried requests: the server first asks the user for confirmation, then the client repeats the request with the answer. The result of such a retry went into the cache. And the next ordinary read of the same address got it without any confirmation. So the cache remembered the answer, but not the conditions under which it was obtained (go-sdk#1371, merged on October 12, 2026).

Remember this bug. It repeats exactly in agent memory, only there almost nobody sees it.

What I saw in the A2A code

A2A has tasks. Tasks have statuses and history. There is a contextId that ties together the tasks of one conversation. It is a good model of work. But it is not memory. When a task ends, everything the agent learned along the way stays inside that task. Another agent will not know about it tomorrow.

I wrote my own A2A SDK for PHP and the a2abridge bridge in Go, and ran both through the official spec test suite (a2a-tck). The PHP SDK passed 244 checks, 3 failed, and that is a known bug in the tests themselves. It was added to the community SDK list on the A2A site (A2A#2275).

The Go bridge was more interesting. It is built on the official a2a-go library. On the same test suite the reference implementation in Python scored 198 passed and 9 failed. The bridge scored 158 and 5 (main branch on a2a-go 2.6.0, run on October 14, 2026). When I went through each failure, all five turned out to be bugs not in my code but in a2a-go itself.

For example, the library wrote the task status time with a local offset, +02:00, and with a different number of digits after the seconds. The spec requires UTC and exactly milliseconds. I fixed it (a2a-go#452, merged on October 14, 2026). Another case: for a finished task the library returned an error code different from the one in the spec (a2a-go#438, fixed in version 2.6.0).

Small things? For a protocol, yes. For memory, no. If two agents in different time zones write to a shared history with time in different formats, the order of events breaks. And the order of events is half of memory.

The conclusion: the standard is young, and it is still being fixed. Building memory inside it means building on sand that has not settled yet.

The three rules I took away

1. Memory is separate from the protocol

MCP is responsible for calling a tool. A2A is responsible for the conversation between agents. Memory is responsible for what the agent knows tomorrow. These are three different lifetimes: seconds, minutes, months. If you mix them in one place, you get the PHP session story: the short-lived wipes out the long-lived.

So in my setup memory is a separate service. The agent reaches it like any other tool, through MCP. The protocol changes, SDKs get updated, and memory stays where it is.

By the way, MCP itself takes the same approach: among the example servers there is a memory server. There, memory is a server, not part of the protocol.

2. Every record has a source and a time

Recall the cache bug in the Go SDK. It remembered the answer but forgot where the answer came from and under what conditions it was valid.

In agent memory this happens all the time. The agent wrote down: “the project uses PostgreSQL 16”. Six months later the project moved to 18. The old record is still there, and the agent confidently answers with an outdated fact. It does not lie, it just does not know when that was true.

So every record in my memory stores which session and which project it came from, and from when to when the fact was valid. When a new fact arrives, the old one is not deleted but closed with a date. Then the question “what database do we use” has an answer, and the question “what did we have in March” has an answer too.

And the time is the same everywhere: UTC. Exactly the problem I fixed in a2a-go.

3. Memory must reach the agent before it answers

I understood this rule last, and it is the most unpleasant one. You can build a perfect memory, and the agent simply won’t look into it. It is sure it knows everything and answers right away.

So I stopped waiting for the agent to ask. In my setup a hook fires on every message of mine, before the agent has read it. It finds related records and rules and puts a short block next to the message. The block has a hard budget, 400 tokens by default, and a hard deadline, a second and a half. If it is late, part of the block simply does not make it, but the message itself is never delayed. Records already shown in this session are not shown a second time.

Memory the agent never reached is useless. It does not matter how clever it is.

What it looks like in my setup

The scheme is simple:

            ┌──────────────┐
  me ─────► │ agent (Claude│ ──── MCP ────► tools: files, database, API
            │  Code etc.)  │
            └──────┬───────┘
                   │ MCP
                   ▼
            ┌──────────────┐        A2A        ┌──────────────┐
            │ memory       │ ◄──── agent ────► │ other agent  │
            │ (separate    │                   └──────────────┘
            │  service)    │
            └──────────────┘
  • MCP for tools, including memory itself.
  • A2A between agents. Agents exchange tasks, and they put knowledge into memory, not into task history.
  • Memory is a separate service with its own storage. Every record has a source and a time, and a hook brings what is needed before the answer.

Everything I wrote above can be checked. All the fixes are in public repositories:

Summary

Agent protocols today solve the problem of communication: how to call a tool and how to agree with another agent. That is an important problem, and it is solved well. But communication is not memory.

If your agent has to start from scratch every day, the problem is not the model and not the prompt. Nobody has built the memory. Build it separately from the protocol, label every record with a source and a time, and bring it to the agent before it answers, not after.

I made my memory open: total-agent-memory, details at totalmemory.dev.

I have a separate article about the bridge itself and the analysis of each failure: How I connected AI coding agents over A2A 1.0.

This text was prepared with an AI assistant (Claude Code). The code, the fixes and the conclusions are mine, and links to every PR are given above.