Guide · 7 min

How to keep context across AI coding sessions without re-explaining everything

You made a decision with your agent yesterday. Today it opens a fresh context window and knows none of it, so you paste the same background again. Here is why that happens, and how to give your agent a memory that survives the session.

The problem

The model has no memory. The session is the memory.

An AI coding agent reasons inside a context window. When the session ends, that window is discarded: the decision you reached, the approach you rejected, the constraint you discovered halfway through, all gone. The next session starts from zero and re-derives everything, often landing on the option you already ruled out. The model isn't being forgetful; it genuinely has no memory of its own. Continuity has to live outside the window.

This gets worse across tools. Claude Code, Codex and Cursor each keep their own private history, if any. Switch tool and the context does not follow you. You become the memory: the only place the "why" of the project is stored is your head, and you pay for it in re-explanation every single session.

The options

What people reach for, and where it stops.

CLAUDE.md / rules files

Great for stable conventions ("use pnpm", "tests live here"). But they're static instructions, not a record of what happened. They don't capture the decision you made in yesterday's conversation, and they're tied to one tool.

Paste the last transcript

Copy the end of yesterday's chat into today's. It works once, but it bloats the context window with noise, and by mid-week you're pasting a wall of text nobody re-reads.

A doc you update by hand

A DECISIONS.md you maintain yourself. Honest and portable, but it depends entirely on your discipline, and the agent doesn't write to it, so it drifts out of date the first busy day.

A better model

A persistent memory the agent reads and writes itself.

The durable fix is a memory store that lives outside any single session and any single tool. At the start of a task the agent loads the relevant project context; at the end it writes back the decisions worth keeping, the "why" and the constraints, not the whole transcript. The next session, in whichever tool, starts already knowing where things stand.

This is the memory half of Tramya, a local-first desktop app. Memory stays on your machine and is exposed over the Model Context Protocol, so the same project memory is shared across Claude Code, Codex and Cursor:

# at the start of a task, the agent pulls what matters
get_project_context(project, "auth rework")

# at the end, it saves only durable decisions
save_memory(project, "Chose Ed25519 over RSA for license keys — smaller, faster verify")

Because it's an MCP store and not a feature buried in one product, the record is tool-agnostic and yours. You can read it, edit it, and it does not vanish when you switch editor or when a session compacts.

Honest limits

What this does and doesn't fix.

Memory is only as good as what gets written. Save everything and recall becomes noise; save nothing and you're back to re-explaining. The useful discipline is to store durable decisions and constraints, not play-by-play. And a memory store is not a substitute for a rules file: conventions still belong in CLAUDE.md, where they're loaded every time. The two are complementary, the rules file for "how we always work", the memory for "what we decided and why". What changes is that the project's reasoning finally lives somewhere the next session can find it, instead of only in your head.