To give a coding agent codebase memory, keep durable project facts outside the chat client. Connect source artifacts, register an MCP memory server, and sync important transcript turns into a scoped library. Then Claude Code, Cursor, Codex, Gemini CLI, and Windsurf can retrieve the same source-linked project memory.
Last updated: June 20, 2026.
What does codebase memory need to remember?
Good codebase memory stores decisions, architecture notes, commands, issue context, setup facts, and durable user preferences. It should not store every terminal line or every token from a chat. The goal is recall with evidence, not a larger pile of text.
Examples that should become memory:
| Memory | Type | Source |
|---|---|---|
| ”This repo runs tests from the worktree, not the main checkout.” | Procedural | AGENTS.md or issue comment |
| ”The marketing site is Astro, not the Vite SPA.” | Semantic | docs/gtm/CONTENT_PLAN.md |
| ”Issue #527 proved tenant-scoped retrieval.” | Episodic/source | GitHub issue and repository queries |
”Use pnpm exec vitest run --config vitest.config.ts --dir tests for alpha-loop checks.” | Procedural | issue plan |
The OpenAI Codex repository describes Codex CLI as a local coding agent, and the Gemini CLI repository documents terminal-first agent workflows with MCP support. Coding agents are increasingly portable. Their memory should be portable too.
Why is transcript sync useful?
Agent transcripts contain the real decisions that do not always land in code: why a test was chosen, which issue scope was rejected, which local command failed, or which product claim was forbidden. If those decisions stay only in a chat, the next agent starts cold.
Answer Engine’s launch CLI surface uses ae sync as the path for importing local Claude Code transcript turns and storing a cursor so retries resume instead of duplicating rows. The local implementation lives in packages/cli/src/sync, with claude-code as the supported transcript source and stable source identifiers for imported turns.
Use:
ae auth login
ae sync once --source claude-code --library personal-memory
ae sync run --source claude-code --library personal-memory --poll-interval 15
That does not mean every transcript token becomes trusted knowledge. It means transcript turns become source artifacts that the memory layer can scope, search, inspect, and curate.
How do you connect memory through MCP?
Register the Answer Engine MCP server in the client that supports MCP:
{
"mcpServers": {
"answer-engine": {
"command": "npx",
"args": ["answer-engine-mcp"],
"env": {
"ANSWER_ENGINE_API_KEY": "ae_live_your_key_here",
"ANSWER_ENGINE_API_URL": "https://engine.answeragent.ai",
"ANSWER_ENGINE_LIBRARY": "personal-memory"
}
}
}
}
The MCP introduction explains why this is portable: MCP gives AI applications a standard way to connect to external systems. The architecture docs show how servers expose tools and resources to hosts through clients.
How should an agent use codebase memory?
Ask it to retrieve, not guess:
Use Answer Engine memory to find the last decision about marketing content tests before editing this repo.
A good answer should identify source-backed memories, cite source artifacts, and explain which fact is current. If the agent answers from general knowledge, the bug is tool-use policy. If it retrieves irrelevant facts, inspect the retrieval trace. If the fact was never written, debug the write path.
How does this differ from CLAUDE.md?
CLAUDE.md, AGENTS.md, and GEMINI.md are useful static context files. They tell an agent how to behave when it enters a repo. They are not a full memory layer because they do not automatically write new decisions, preserve source lineage for every memory, or expose deletion handles.
Read CLAUDE.md is not memory for the boundary. The short version: static files are boot instructions; memory is a source-aware data layer.
What should you verify?
Run a fresh-session recall test:
- Save a small project fact through MCP or transcript sync.
- Start a new agent session.
- Ask the agent to use Answer Engine memory for that fact.
- Check that the answer cites a source artifact.
- Ask a negative question that should not retrieve unrelated repo facts.
If you use multiple clients, repeat the same question from another client. Portability is proven when the same memory library works outside the tool that produced it.
What should you read next?
Use Add persistent memory to Claude Code, Add persistent memory to Codex, and Portable Agent Memory. For troubleshooting, open the failure-mode catalog.