Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseCode / SDK · ActionableX: @plusxbt→ original

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
Microsoft Taught Claude Code to Remember Past Sessions: Task Costs Down 23.6%
Source: X: @plusxbt. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceX: @plusxbt ↗
Editor-in-Chief
Key metric #1A fact enters memory after 3 confirmations; disproven facts are removed
Key metric #2Cheaper in all 30 cells of the test table, according to the post's author
Key metric #3Lightweight subagents start with 7.4K tokens instead of 131.1K

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.

Story

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.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

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.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…