Cody Memory: How to Make Sourcegraph Cody Remember Your Project
Sourcegraph Cody resets every session. Here is how to add persistent memory via MCP so Cody remembers your project, conventions, and past decisions.
MemNexus Team
Engineering
Sourcegraph Cody is an AI coding assistant built on deep codebase context. With 816K+ VS Code installs and support for JetBrains IDEs and Visual Studio, Cody's defining advantage is Sourcegraph's code intelligence engine — it pulls context from local and remote repos at scale using code search, symbols, and cross-repo references. Multi-model support (Claude Sonnet, GPT-4o, Gemini, Mixtral) lets you pick the model that fits the task. Chat with @-mentions (@File, @Symbol, @Repo, @Web, @Directory), auto-edit for contextual modifications, autocomplete, and a Prompts Library for reusable prompt templates.
But Cody has a gap. Every chat session starts from zero. It doesn't know what you built last week, what patterns your team follows, or why you chose one architecture over another three months ago. You explain the context. You move on. Next session, you explain it again.
That's not a flaw in Cody. It's the underlying architecture. And there's a practical way to extend it.
What Cody resets every time
The context loss is easy to underestimate until it compounds. Here's what disappears at the end of each session:
- Project decisions. Why you chose this database. Why you ruled out the obvious pattern. What trade-offs shaped your current service architecture.
- Coding conventions. How you structure modules in this project. The error handling patterns your team has standardized. The test organization approach that isn't captured in any linter config.
- Debugging history. That two-hour investigation into a race condition in your event processing pipeline. The root cause you eventually found. The fix and why it holds.
- Accumulated context. Everything you re-established in the last conversation that you'll need to re-establish again tomorrow.
Cody's official docs warn that "for longer, ongoing chats, Cody can begin to 'forget' context." Chat history is stored locally but is not fed back into new sessions. The context window is per-session with hard limits. Each conversation is an island.
Why this is a hard problem to solve alone
Cody is built on large language models. LLMs process a context window and produce output — but they don't write to persistent storage between calls. When the conversation ends, the context window closes and what was in it is gone.
This is a property of how these models work, not something Sourcegraph can simply configure away. Every coding agent on the market has the same constraint — GitHub Copilot, Cursor, Claude Code, Kiro, all of them. The reset is universal because the cause is universal.
For a deeper look at why this is architecturally hard to solve, see How AI coding assistants forget everything.
What Cody's codebase context can do (and what it can't)
Cody's real strength is code intelligence. Sourcegraph indexes your codebase and can find relevant functions, symbols, and usage patterns across repositories. Cross-repo references mean Cody can trace a function call from your service into a shared library and understand how the pieces connect. This is structural context — deep, real-time understanding of what your code IS right now.
If you haven't used @-mentions to scope Cody's context to specific files, symbols, or repos, you should. They meaningfully improve response quality for questions about your current codebase.
But structural context is not temporal context. Cody can find your functions and APIs but can't remember the debugging session that led to their current design, or the three approaches you tried before settling on this one. It knows your code exists. It doesn't know why it's that way. Cody knows your code. MemNexus remembers your journey with it.
The MCP approach: MemNexus as Cody's memory layer
Model Context Protocol (MCP) is a standard for connecting AI tools to external capabilities. Cody was a launch partner with Anthropic for MCP and has native support for MCP servers, with agentic tool use that lets Cody autonomously determine which MCP tools to invoke. MemNexus implements it. For a deeper look at why MCP is the right protocol for giving coding agents persistent memory, see MCP as a Memory Layer: Why Coding Agents Need More Than Context Windows.
When you connect MemNexus to Cody via MCP, the AI gains access to a persistent, searchable memory store that lives outside any single session. It can pull relevant context at the start of a conversation. It can save decisions and findings during a session. And it can search what you already know when you hit a familiar problem.
Setup takes about two minutes:
npm install -g @memnexus-ai/cli
# Interactive prompt — key stays out of shell history
mx auth login
mx setup
mx setup detects Cody and configures the MCP server automatically. After that, memory tools are available in Agent mode. Note that MCP tools require Agent mode in Cody — they are not available in regular Chat.
What actually persists across sessions
Here's what MemNexus stores and surfaces across your Cody sessions:
Coding conventions with context. Not just "we use microservices" but how you structure service boundaries in this project, why you use a specific API versioning pattern, and the deployment configuration your team settled on. Details that a linter can't capture.
Decisions with their reasoning. "We use Kafka for event streaming" is table stakes. "We chose Kafka over RabbitMQ because our access patterns require replay capability for the audit service, fan-out to multiple consumers is growing, and the ops team already runs Kafka clusters for the data pipeline" is what a coding agent actually needs to give relevant suggestions.
Debugging history. That investigation into flaky integration tests you completed last week — root cause, fix, what you ruled out along the way — becomes a memory. When similar symptoms appear, Cody can surface what you already found.
Growing project knowledge. After a month of active development, your memory store reflects the real shape of the project: the deployment gotchas, the cross-repo dependency patterns that took days to untangle, the things that bit you once and shouldn't bite you again. Sourcegraph's cross-repo context means Cody can find patterns across your repos — MemNexus adds the story behind those patterns.
The compound effect
The value isn't obvious on day one. It compounds.
After a few weeks, Cody walks into each session with the actual history of your project — not just the code intelligence it can pull from your repos right now, but the decisions you made under pressure, the bugs you traced to their root, the patterns that emerged from real use. Re-explanation drops. Discovery time drops. The things you've already figured out stay figured out.
The right tool for each job: Cody's deep code intelligence, cross-repo context, symbol search, and multi-model flexibility are hard to beat. MemNexus adds the one thing Cody can't provide alone — memory that outlasts the session. Structural knowledge and temporal knowledge, combined.
Using a different AI coding tool?
The same MCP-based approach works across the coding agent ecosystem:
- GitHub Copilot Memory: How to Make Copilot Remember Your Project — persistent context for Copilot Chat
- Continue.dev Memory: How to Make Continue Remember Your Project — persistent memory for Continue.dev
- Kiro Memory: How to Make Kiro Remember Your Project — persistent memory for Kiro
MemNexus is currently in invite-only preview. If you want Cody to actually remember your project, request access at memnexus.ai/waitlist.
For a detailed look at how MemNexus compares to built-in memory features, see our comparison pages.
Get updates on AI memory and developer tools. No spam.
Related Posts
JetBrains AI Memory: How to Make JetBrains AI Remember Your Project
JetBrains AI Assistant resets every session. Here is how to add persistent memory via MCP so JetBrains AI remembers your project, conventions, and past decisions.
Kiro Memory: How to Make Kiro Remember Your Project
Kiro resets every session. Here is how to add persistent memory via MCP so Kiro remembers your project, conventions, and past decisions.
Tabnine Memory: How to Make Tabnine Remember Your Project
Tabnine resets every chat session. Here is how to add persistent memory via MCP so Tabnine remembers your project, conventions, and past decisions.