TMF: Helping AI Coding Agents Detect Stale Source Context
AI coding agents can remember code that no longer exists in the same form.
An agent reads a method, forms an understanding, and starts working. Another branch is merged. The files change, but the agent’s earlier understanding remains in its conversation.
We built TMF to help detect that mismatch.
Source context needs a freshness check
TMF binds indexed information to source evidence and checks those bindings against the selected working tree. When a binding no longer matches, it marks the information as stale and provides source locations to revisit.
The intended workflow is simple:
1.Query the context for the task’s working tree.
2.Check whether the source bindings are still fresh.
3.Re-read current source where necessary.
4.Continue development and run tests.
TMF does not replace source code as the authority. It helps agents recognize when previously gathered context needs to be checked again.
A version-evolution test in Guava
We tested this with a persistent coding-agent session in a real Guava checkout.
First, the agent read the existing hash-combination implementation and its array-ownership contracts. We then integrated a real upstream change while retaining the old TMF index.
The change replaced copying input bytes with reading an internal byte-array view. That makes the distinction between reading an array and owning it particularly relevant when reviewing immutability and aliasing.
When the same agent resumed, TMF marked both old method bindings as stale. The tool trace showed that the agent queried the stale context, read the current implementation, and then added regression coverage.
The resulting test exercised real Guava code and passed 60 checks covering arithmetic, input immutability, result-storage independence, and invalid inputs. We also reran it successfully outside the agent session.
This was a test-development task, not a claim that the upstream change introduced a bug.
What this demonstrates—and what it does not
The experiment demonstrated an end-to-end path: old context, an upstream update, stale detection, actual source re-reading, and continued development.
It does not establish that TMF makes every task faster or cheaper. The agent followed an explicit TMF usage protocol; freshness detection alone is not a mandatory write barrier.
Correct working-tree selection still matters. Changes occurring between a check and a later edit also remain a separate concurrency concern.
We found a practical limitation, too: the suggested reading slice included some unrelated methods. Reducing that noise is an improvement area.
Looking for early feedback
We are looking for developers who use AI coding agents with multiple branches, Git worktrees, or long-running sessions.
Have you seen an agent continue working from an outdated understanding after a merge or dependency change? How did you notice it, and what would a useful freshness check need to tell you?
Our focus is not “more context at any cost.” It is helping agents recognize when their existing context no longer matches the code they are about to work on.
Try TMF and share your feedback
TMF is available as an early preview. If you use AI coding agents across branches, Git worktrees, or long-running sessions, we would love to hear how it fits your workflow.
GitHub repository: https://github.com/kyle641320/true-memory-fragments
Early preview guide: https://github.com/kyle641320/true-memory-fragments/blob/master/docs/early-preview.md
Report an issue or share feedback: https://github.com/kyle641320/true-memory-fragments/issues/new/choose
When sharing feedback, please include your TMF version, coding-agent client, and whether the tool selected the correct working tree. A small, sanitized example of stale context or unnecessary re-reading is especially useful.
