{
  "id": 5077707,
  "title": "Context anchoring works. Files, not a service.",
  "url": "https://urgent.news/2026/09/02/context-anchoring-works-files-not-a-service",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-02T11:49:54.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bojantomic/context-anchoring-works-files-not-a-service-5ek2"
  },
  "original_language": "en",
  "account": "For years, I habitually kept AI chat sessions open for extended periods, but closing one required re-explaining my project from the beginning. Rahul Garg introduced a solution called \"context anchoring,\" which involves making that alignment permanent. It was posted on martinfowler.com, and its value is evident. To determine if you've achieved it, close your chat session and reopen a new one without feeling anxious. This reframes the issue, as I previously viewed the long session as the asset, when it was merely a symptom. Files, not a service\n\nOnce you acknowledge that context should exist outside the conversation, you must determine where. Many hosted AI memory products exist for this purpose, and I benchmarked one before making my decision. However, I prefer to anchor to markdown files within the repository. This approach is offline, doesn't rely on an account or backend, and isn't susceptible to outages. Diffs can be reviewed, and teammates can argue about decision records in pull requests. You cannot review a vector store. It survives vendor changes.\n\nI maintain an AI tools directory and spent the past month correcting listings for products that acquired and ceased operations. Relying on a seed-stage startup for your project's memory is a genuine risk, not just theoretical. Sync can be an optional layer but shouldn't be the foundation. I measured both methods on the same machine and found that file-based memory required a one-line index and had 15 entries, totaling 579 tokens per request. In contrast, the hosted memory solution had 27 tool schemas and stored 0 entries, consuming 8,866 tokens per request. The hosted service costs about 15 times more per request before any memory has been processed. The reason is architectural. The tool definitions for the hosted service are included in every request, regardless of whether they are called, making a broad tool surface a constant cost. In contrast, the file-based index loads one line per memory and fetches the body only when necessary. The same concept applies to an order of magnitude difference in cost, solely due to where you store the state. I would add: anchors can become outdated. Garg cautions that his advice is specific to capturing decisions while they are fresh. My experience shows that anchored context decays like documentation but is read with more trust by an AI, leading to actions being taken. A decision record naming a function that was deleted last month would be asserted instead of questioned. Therefore, my working rule is to include the date and the reason for each anchor, and verify any file, function, or flag against the repository before acting on it. Writing the anchor is the easy part; keeping it accurate and relevant is the real challenge, and I have not seen a proper solution yet. If you have already implemented this, I would like to learn how you manage staleness. That remains an open problem.",
  "summary": "I used to keep AI chat sessions open far longer than made sense, because closing one meant re-explaining my project from scratch. Rahul Garg has a name for the fix : context anchoring, \"the practice of making that alignment durable.\" It went up on martinfowler.com and it is worth your ten minutes. His test for whether you have got it right is the part that stuck with me: If I can close my chat…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}