Microsoft Taught Claude Code to Remember Past Sessions: Task Costs Down 23.6%
Claude Code works out again, every session, how to run the tests in your repository, and pays for it in tokens. Microsoft Research built TokenEconomizer, which stores verified facts and loads them at startup, like a cheat sheet. On 277 SWE-Bench tasks (real bugs from open-source projects), costs fell by 18.4–30.9%, 23.6% on average. For daily agent runs, it is worth testing this memory on your own code.
AI-processed from X: @plusxbt; edited by Hamidun News
Picture a new employee who arrives at work every morning with a blank head. He asks again how the tests run, where the configuration lives, and which build command works. That is exactly how Claude Code, Anthropic's AI programming agent, behaves: every session it studies your repository from scratch, and every token (a unit of text that you pay for) costs money.
Researchers at Microsoft Research built TokenEconomizer, a tool that gives the agent a "cheat sheet" of verified facts about the project. On 277 tasks from the SWE-Bench benchmark (a set of real bugs from open GitHub repositories), the cost of solving them fell by 18.4–30.
9% across five different configurations. The post's author cites the average, 23.6%, in the headline.
Over the past few weeks, six more small repositories have appeared around the idea. All figures come from a post on X and project descriptions; we did not verify them independently.
How TokenEconomizer Saves Money
The tool extracts facts about the project from past sessions: how to run the tests, where things are, which commands work. At the start of a new session, it loads these facts into the agent, and the agent does not spend tokens re-studying the repository. To keep memory from filling up with random conclusions, a fact enters it only after three sessions confirm it. If a new session shows otherwise, the fact is removed.
According to the post's author, TokenEconomizer came out cheaper in all 30 cells of the test table, meaning in every comparison of a "configuration and task set" pair. For a practitioner, this matters more than any single impressive number: the effect does not depend on one lucky combination of model and settings.
Six Repositories Alongside
The post's author gathered six more projects. Each fills a separate gap in the agent's memory and context:
- loom from ClickHouse. A self-hosted MCP server (MCP is a protocol through which an agent connects external tools): what one agent has learned, another can find. A plugin for Claude Code loads context at startup and records every session.
- nomore (
npx @globalmpc/nomore). Finds instructions you repeated in at least two sessions and turns them into rules for the CLAUDE.md file, which stores persistent instructions for the agent. These rules survive context compaction. - stalemap. Finds dependencies that changed after the date up to which the model was trained. Before the agent starts, it writes a ranked list of changes into CLAUDE.md so the model does not write code against an outdated API.
- landmines. Compares the lockfile (a file with exact library versions) against open issues on GitHub. If an edit touches a known problem, the agent stops once and takes the workaround from the discussion.
- Rulebook. Shows all CLAUDE.md and AGENTS.md files across your projects and highlights those that contradict each other. Requires macOS 14 or later.
- Lightweight subagents (the mdalexandre repository). Small tasks go to agents that skip CLAUDE.md, the skills list, and MCP tools. Such a subagent starts with roughly 7.4K tokens instead of 131.1K.
The last item is telling. When 131K tokens are spent at startup, a small edit to one file becomes uneconomical. A nearly 18-fold difference in startup context hits the bill hardest when many agents run.
What to Do About It, and the Caveats
For teams running Claude Code daily, the takeaway is practical. Treat agent memory as part of engineering infrastructure: it needs rules for which facts get in, an expiry policy, and a way to correct it. A simple start: nomore, to move repeated instructions into CLAUDE.md. Then check dependencies with stalemap and landmines. If you run agents often, test TokenEconomizer on your own repository and compare costs before and after.
The caveats are significant. All seven repositories are younger than six weeks, so maturity and support need to be checked separately. SWE-Bench consists of tasks from open repositories, and the effect may differ in closed corporate code. The 23.6% average should not be promised as guaranteed savings: the range across configurations is wider than a single figure. Finally, any automatic memory can lock in a wrong conclusion, so the "three confirmations" rule needs to be tested in practice rather than taken on faith.
The trend itself is clear, though. Competition among coding agents is shifting from model size to how carefully context is supplied to the model and how cheaply that is done.
- Nov 21, 2026Anthropic Raises $81B in IPO at $2 Trillion Valuation as Protesters Show Up Outside Its Offices
- Nov 21, 2026Banks Stand to Earn $550 Million on Anthropic's IPO, More Than on SpaceX
- Nov 21, 2026Anthropic's IPO Order Book Is Several Times Larger Than the Shares on Offer; Founders Set to Receive $1.75 Billion
- Nov 21, 2026Anthropic Researcher Claims He Proved the Riemann Hypothesis with Claude in Six Weeks
Key Questions Answered
How TokenEconomizer Saves Money?
The tool extracts facts about the project from past sessions: how to run the tests, where things are, which commands work. At the start of a new session, it loads these facts into the agent, and the agent does not spend tokens re-studying the repository. To keep memory from filling up with random conclusions, a fact enters it only after three sessions confirm it. If a new session shows otherwise, the fact is removed.
What are the key details on Six Repositories Alongside?
The post's author gathered six more projects. Each fills a separate gap in the agent's memory and context: loom from ClickHouse. A self-hosted MCP server (MCP is a protocol through which an agent connects external tools): what one agent has learned, another can find. A plugin for Claude Code loads context at startup and records every session. nomore (npx @globalmpc/nomore).
What to Do About It, and the Caveats?
For teams running Claude Code daily, the takeaway is practical. Treat agent memory as part of engineering infrastructure: it needs rules for which facts get in, an expiry policy, and a way to correct it. A simple start: nomore, to move repeated instructions into CLAUDE.md. Then check dependencies with stalemap and landmines. If you run agents often, test TokenEconomizer on your own repository and compare costs before and after. The caveats are significant.
Build & Ship Production AI Agents Without Boilerplate Code
Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.