Write memory - not code
2026-10-26Today's AI agents don't have memory - they have context. Context is built by loading existing files from disk at the start of every new session with an agent. For example, Claude Code reads markdown files (.md) from the folder where the session is opened (in addition to any global context with general instructions).
But context is like RAM for the computer: It is cleared when you shut down your agent.
At the same time, the next developer won't get the same context as the one who generated the code - unless you think about it as a developer.
We should use some of the time we save on writing code, to write memory that preserves critical decisions and important elements of the solution.
A simple example from a solution I've built: An AI news agent that sends me an email every morning at 06:00 with the day's AI news. It currently works from 12 different RSS feeds, which are in priority order. There is also a check for whether different sources have roughly the same news. If so, it shouldn't be repeated - but simply marked with the different sources as links.
Without a written design decision to uphold this principle, there's a pretty good chance my AI agent would simply add a new source at the bottom of the order when I ask for a new source. With this rule written into CLAUDE.MD:
Priority = position in FeedDefinitions.All (Sources/FeedDefinitions.cs), highest at the top. The table below follows the same order. If a feed is added without a specified priority, Claude must ask for it. Tip to the user: priority can be specified relative to the other feeds, e.g. "just below DR Viden".
the agent is guided to ask me where in the order a new source should be added - in case I had forgotten it, 6 months later. (CLAUDE.MD is read into context for every new Claude Code instance started in that repo).
Design decisions of this kind are important to preserve, for the sake of future maintenance. You may yourself be the next person to revisit the solution in 6 months - and even for you as the original builder, it can be hard to remember all the decisions and why we made them. It costs time, tokens and risk.
Write memory instead of code
So use some of the time we save on less manual coding to write down and preserve important choices made and their background. Also, things the agent should always ask about - rather than just assume and silently carry on.
Make this knowledge shared and version-controlled by placing it side by side with the code in its repo.
The agent can help maintain it, once it's been started and/or when you ask it to.
Here, a need arises to read the file(s) that make up the memory. It's worth making sure the memory is up to date and precise before you hand the project/product over again.
Without this written memory, maintenance becomes increasingly difficult over time - and it becomes harder for your agent to run autonomously for longer periods.
Apply the scout principle here:
Always leave the memory in a better state than when you arrived.