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.
- Dec 2, 2026Ai2 Releases MolmoWeb2 Web Agents: 27B Model Solves 75.3% of Tasks
- Dec 2, 202650 AI Models Beat 62 Teams at 'Zakovat': 48.3% Correct Answers vs 39.8%
- Dec 2, 2026Claude Fable 5.2 ran 1,000 agents for eight days and built an operating system
- Dec 2, 2026Amazon Releases Ergo Open Weights for Coding: 1.1 Trillion Parameters and 2,200 Tokens per Second
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.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
