Coding agents can retain information between sessions. They can save investigations, remember architectural decisions, and retrieve knowledge that would otherwise disappear when a session ends.
But the code they learned about keeps changing.
Imagine an agent investigating a bug in a pointer-movement handler. It identifies the relevant implementation and records its conclusions. A month later, another agent investigates a related problem and retrieves those notes.
The function may have moved, been renamed, or changed substantially. Even adding lines elsewhere in the file can make an old line reference point to unrelated code.
There is another problem: the next agent might never retrieve the investigation because it describes the same code using different terminology. Or it might retrieve an investigation of an unrelated function with the same name.
We wanted to understand how often these problems occur in real repositories, how well coding agents handle them, and whether connecting persistent knowledge to source-code structure could improve retrieval and reuse.
Why AI Coding Agent Memory Needs Source Code References
An agent can preserve knowledge in a Markdown file, a session summary, or a dedicated memory system such as Cognee.
These approaches make earlier investigations available to future sessions. Memory systems can also organize and retrieve knowledge based on the task an agent is performing.
Consider a saved observation:
The pointer-move handler contains the crop-move logic. Check this function when investigating crop dragging.
How does the next agent identify the exact function its predecessor examined?
A file path and line number provide a starting point, but line numbers describe positions in a particular version of a file, not durable references to functions. Function names are more useful, but they are not necessarily unique and can change. A Git commit makes the original source recoverable, although the agent still needs to connect that historical implementation to the current code.
These limitations also affect retrieval. A memory system relying on textual or semantic similarity might miss earlier investigations that use different descriptions of the same function, or retrieve observations about unrelated implementations with similar names.
We used Enola to establish that connection.
Enola builds a structural representation of a codebase by extracting symbols and their relationships from source code. Its locate functionality resolves a source location to a symbol:
enola locate src/app.ts:120
The result includes the symbol's identifier, name, and body_hash, a fingerprint of its code.
An agent can save this information alongside its investigation. When the investigation is retrieved later, Enola can identify the corresponding symbol and check whether its implementation has changed.
The reference can also support retrieval itself. If several investigations refer to the same symbol, a memory system can associate them with the same implementation regardless of how the agents described it.
This provides structural information that complements semantic retrieval without replacing it.
Experiment Methodology: Testing Agent Memory Against Codebase Changes
We used two open-source TypeScript projects, Excalidraw and Vite, to examine what happens to saved agent knowledge as a repository evolves.
The experiment had three parts: collecting agent investigations from historical repository versions, checking their source references against later versions, and testing whether an agent could identify related investigations using only their written descriptions.
Selecting historical fixes and recording agent investigations
We selected twenty historical fixes from each repository, giving us forty fixes in total.
For every fix, we checked out the repository at a revision preceding the fix and started a fresh Claude Code session using Opus 5.5.
The agent was asked to investigate the code in that earlier state and record its observations. Each investigation was saved in a local MEMORY.md file, with references to the relevant source locations.
Using a fresh session for each investigation prevented the agent from relying on knowledge accumulated during previous investigations. The saved observations represented what could be carried into a later session.
The investigations produced multiple source references in some cases. Across the two projects, we evaluated 45 recorded locations in Excalidraw and 51 in Vite, for 96 locations in total.
These locations, rather than the number of historical fixes, were the unit of measurement for the source-location experiment.
Evaluating source references across repository revisions
We examined the repositories at later revisions, including a point thirty days after the original investigation and a later revision of each project.
For every saved location, we checked whether the original line reference still pointed into the function the agent had investigated.
A reference was counted as incorrect when the recorded location pointed into a different function, even if the original function still existed elsewhere in the repository.
We then used Enola to resolve the original source locations into symbol identities and code fingerprints. By preserving the symbol identifier, name, and body_hash, we could check the references against subsequent repository revisions without relying solely on their original line numbers.
This allowed us to distinguish a source location becoming outdated from the underlying implementation actually disappearing or changing.
Measuring implementation changes separately from line movement
We also followed an individual pointer-movement function in Excalidraw across 188 daily repository revisions.
For each revision, we examined whether the function's line number had changed and whether its implementation had changed.
The comparison separated changes caused by edits elsewhere in the file from changes to the function's own code.
We then conducted a separate review using eighteen saved observations about functions whose implementations had changed. A fresh Claude Code session examined the later code and assessed whether the earlier observations still applied.
This tested an important limitation of fingerprint-based checking: detecting a code change does not establish whether a previous explanation has become incorrect.
Testing retrieval using written observations
Finally, we investigated whether earlier observations about the same implementation could be identified without structural references.
We examined cases in which separate agent investigations reached the same function but described it differently, and cases in which unrelated functions shared the same name.
For the text-only comparison, the agent received the written observations without Enola's symbol references and was asked to identify recurring functions.
We compared its results with the identities obtained by resolving the original source locations through Enola.
In the Excalidraw case, we repeated the text-only ranking five times. We also examined cases in Vite where shared function names or different descriptions of related code affected the agent's grouping.
These tests evaluated whether natural-language observations were sufficient to identify common source-code symbols. They were not a benchmark of a complete memory retrieval system, nor did they measure Cognee's retrieval performance.
Results: How Code Changes Affect Agent Memory
Why File Paths and Line Numbers Become Stale
After thirty days, 13 of 45 recorded Excalidraw locations and 8 of 51 Vite locations pointed into a different function.
At the later repository revisions we examined, those numbers increased to 25 and 18, respectively.
| Project | Locations examined | Incorrect after 30 days | Incorrect at later revision |
|---|---|---|---|
| Excalidraw | 45 | 13 (29%) | 25 (56%) |
| Vite | 51 | 8 (16%) | 18 (35%) |
The original functions still existed. Their positions had changed, usually because of modifications elsewhere in the files.
An agent following the old references could therefore find valid source code without finding the implementation its predecessor had investigated. The reference still opened a file, and the code at that location could look entirely plausible.
Using Enola, we resolved the original locations to symbols and recorded their identities and fingerprints. We could then check those references against later repository revisions without relying exclusively on line numbers.
Tracking Function Changes Across Code Versions
We tracked a pointer-movement function in Excalidraw across 188 daily repository revisions.
Its line number changed 93 times, while the code inside the function changed only 25 times. In the remaining 68 cases, edits elsewhere in the file had shifted its position without changing its implementation.
Enola's fingerprints allow us to distinguish between a function that moved and one whose implementation changed.
We also asked a fresh Claude Code session to review eighteen saved observations about functions whose implementations had changed. The agent judged that some remained accurate despite modifications elsewhere in the enclosing functions.
A changed fingerprint is therefore a reason to inspect an earlier observation, not automatically discard it. Equally, an unchanged function body does not guarantee that the observation remains valid: dependencies, callers, or surrounding behavior may have changed.
For a memory system, these signals can help determine which retrieved observations require further verification.
Improving Agent Memory Retrieval with Symbol References
The third experiment concerned retrieval rather than code movement.
In Excalidraw, five separate investigations reached the same function but described it differently. The agents referred to pointer movement, crop movement, an inner closure, and other related code in the same file.
Resolving their saved source locations against the original repository revisions connected all five investigations to:
App.onPointerMoveFromPointerDownHandler
We then asked an agent to identify recurring functions using only the written observations, without Enola's structural references.
Across five attempts, it never placed that function among its top five recurring functions.
In four entries, the function name recorded in the text disagreed with the function containing the cited source location.
Vite exposed the opposite problem. Several plugins contained functions named renderChunk, and the agent grouped observations about different implementations under that shared name. It also failed to connect seven investigations involving cssPostPlugin, which contained several relevant functions.
This illustrates a limitation of text-only retrieval. Similar descriptions do not necessarily refer to the same code, and different descriptions can refer to exactly the same implementation.
With source-derived symbol references, a memory system can retrieve investigations associated with a particular implementation independently of their wording.
For example, an agent investigating App.onPointerMoveFromPointerDownHandler could retrieve earlier observations associated with that symbol, including those originally described as crop-movement investigations.
Systems such as Cognee can potentially incorporate these references into their existing retrieval mechanisms, using symbol identity alongside semantic relationships.
Our experiments demonstrated the limitations of text-only identification and how structural references address them. They did not measure an end-to-end improvement in Cognee's retrieval performance.
How to Track Source Code References with Enola Locate
Our experiments used MEMORY.md because we worked with Claude Code. The approach is not tied to a particular memory format.
When an agent records an observation, it can resolve the relevant source location using Enola:
enola locate src/app.ts:120
The returned id, name, and body_hash can be preserved alongside the observation. Enola calls this saved symbol reference a stamp.
For historical investigations, locate also supports the --at option to resolve a location against a specific repository revision. This ensures the reference identifies the code as it existed when the investigation took place.
Stamps can be stored as JSONL records and checked later:
enola locate --stamps findings.jsonl
Enola reports the status of each reference:
| Status | Meaning |
|---|---|
| current | The symbol's code is unchanged. |
| moved | The same code was found at a different location. |
| rewritten | The symbol still exists, but its code changed. |
| gone | No matching symbol was found. |
| ambiguous | Enola cannot establish a unique match. |
This gives an agent two opportunities to use Enola: when saving an observation, to record the source-code symbol it describes, and when retrieving it, to check the reference against the current repository.
A memory system can also index observations by their associated symbols. If an agent is investigating a particular function, earlier observations about that function can be retrieved without depending exclusively on semantic similarity.
Enola exposes locate through its CLI and MCP interface, allowing this workflow to be integrated with coding agents and persistent memory systems.
The memory system still controls storage, retrieval, and ranking. Enola supplies the symbol references and information about changes to their implementations.
Keeping Agent Memory Relevant as Codebases Evolve
Our experiments exposed several problems with carrying source-code knowledge between agent sessions.
Line references became unreliable as repositories evolved. Functions frequently moved without their implementations changing. Agents investigating the same code produced descriptions that made their observations difficult to connect, while shared function names caused unrelated investigations to be grouped together.
Persistent memory systems such as Cognee address the storage, organization, and retrieval of agent knowledge. Enola contributes source-derived information that those systems can use to connect saved observations to the implementations they describe.
That connection can improve how memories are organized and selected for retrieval. It also allows an agent to check whether the code behind a retrieved observation has changed before relying on it.
There are limits. A valid symbol reference does not prove that an earlier explanation was correct, and changes elsewhere in the system can invalidate an observation without changing the referenced function.
But the agent no longer has to reconstruct every connection between its earlier observations and the current repository from natural-language descriptions alone. It can use Enola to establish which code those observations refer to and what happened to that code since they were recorded.
The interpretation remains the agent's responsibility.
Further reading
- Enola — Flows and locate documentation
- Enola — GitHub repository
- Veljko Kovač — Article on agent memory (X)
- The Four Memory Layers Every Coding Agent Needs
- coding agents
Keep reading
More from the blog
Nov 7, 202612 min read
How true is the AST? What a parser library really gives you
Code tools treat the abstract syntax tree as ground truth. Upgrading the parsers behind Enola shows how much of that truth depends on a grammar, a version and a runtime.
Oct 27, 20267 min read
Enola for VS Code: architecture checks alongside your agent sessions
Enola for VS Code shows architecture findings, rule checks and recorded coding-agent sessions from Claude Code, OpenCode, Codex and pi inside the editor.
Oct 23, 202614 min read
Claude Code benchmark: Enola on code the model had never seen
An A/B Claude Code benchmark across five private repositories, measuring Enola's effect on answer accuracy, cost, time and consistency.