Purpose
Coding agents learn library usage from training data, and training data has a cutoff date. When a project locks a newer version, the agent may still write code against the old API (for example, using maxSteps with AI SDK 7, required_error with zod 4, or middleware.ts with Next 16). stalemap finds the dependencies that changed after the model's training cutoff and informs the agent in three ways.
Key capabilities
- Notes: Writes a short, priority-ordered list of changes into AGENTS.md or CLAUDE.md, so the agent can read it before starting work. The content is located between
<!-- stalemap:start -->and<!-- stalemap:end -->, and text outside the block is not modified. - Edit-time guard: Runs the project's own type check after every edit. If the code uses an API that changed after the cutoff, the agent immediately receives the compiler error along with the corresponding note (or the release notes / upgrade guide section that explains the issue); it also reports code that still compiles but whose usage has changed, such as moved config keys, moved members, renamed file conventions, and tsconfig.json options that the project's TypeScript rejects.
- search_changes: An MCP tool that lets the agent ask in its own words (e.g., "resolve alias in next.config") and get matching changes with their sources. It can also be invoked from the command line with
stalemap search <query>.
Usage
- Install and run via npm:
npx stalemap; the latest version is stalemap 0.4.1. - Claude Code plugin: provides a SessionStart hook (puts the notes into the session context without writing files), a PostToolUse hook (runs the guard after every Write/Edit), the stalemap MCP server, and two skills (
/stalemap:syncwrites the notes block; upgrade lets Claude query a package's changes before using or upgrading it). The hooks and MCP server run vianpx -y stalemap@latest. MCP tools include search_changes, package_changes, project_changes, and check_notes. - Other agents:
setup --agentwrites notes for each agent, registers the MCP server, and installs the guard as a post-edit hook in a single command, as committable project files; it merges into existing config files, preserves entries it did not write, and repeated runs produce no changes. - Model and cutoff: specify with
--model, or read the model from Claude Code, Codex, OpenCode, or Gemini CLI configuration, or$ANTHROPIC_MODEL; the cutoff date comes from models.dev (with a built-in fallback table), and can also be specified with--cutoff YYYY-MM-DD. - Dependency scope: scans directly imported local dependencies, plus dependencies configured in config files (tsconfig.json, next.config.*, Prisma schema, Vitest and ESLint configs, etc.);
--allCheck all direct dependencies. Locked versions come from node_modules or lockfiles (npm, pnpm, yarn, bun). - Change sources: download the .d.ts of both versions and compare them with the TypeScript compiler API (removed, renamed, moved exports, new required parameters, removed or added required options, new @deprecated tags and hints); release notes come from the package's changelog or GitHub Releases, scored by breaking-change signals and the APIs the project uses;
--guidesHandle changes not reflected in type signatures (such as new defaults, renamed file conventions); Claude turns them into short notes, and only notes that cite guides are kept;--examplesGenerate Before → After lines under the top notes, and keep them only if they compile against the locked version. - Budget: 1,800 tokens by default (
--budget), prioritizing content relevant to the project's usage. stalemap probeMeasure which notes the model actually needs: have the model write code for each change, type-check it against the locked version, then rerun with the notes; notes the model can already complete correctly are removed from the block.- See
stalemap --helpfor other commands and options, including--llm(summaries written by Claude) and precomputed reports for about 200 fast-changing packages (not yet hosted).
When to use
For JavaScript/TypeScript projects, used with Claude Code, Cursor, Codex, OpenCode, or any MCP client. The project says that in a blind, preregistered benchmark of 66 tasks built from changes published after June 2026, claude-sonnet-5-5 agents using stalemap had a session pass rate of 89%, versus 68% without help, and 73% with a plain tsc --noEmit hook run after each edit.
Limitations
- Only JavaScript and TypeScript are supported, and only one package.json is handled (workspaces are not yet traversed).
- Packages without built-in types only get release-note-style notes (no @types/* comparison).
- Usage tracing stops at import names and x.member access; it does not trace instance chains like client.messages.create({ temperature }).
- Behavior changes not reflected in type signatures can only come from release notes and (when --guides is enabled) upgrade guides; settings that neither mentions cannot be covered.
- Release-note ordering is heuristic and noisy for prose-style changelogs.
- Agents sometimes ignore correct notes; guards catch compile failures and some changes that still compile (moved keys and members, renamed files), while other stale code that still compiles is caught only when notes cover it.
- The project is early-stage and maintained by one person.
- Other agents and models have not been measured; Cursor does not yet pass postToolUse hook context to the model, so setup adds a stop-hook fallback that sends unreported findings as follow-up messages.
- Data egress: package names and versions are sent to the npm registry, GitHub (changelogs and releases, can use GITHUB_TOKEN or gh login), and models.dev; source code is never uploaded, and import scanning happens locally. With --llm, --examples, or --guides, type diffs, release-note excerpts, guide text, and imported API names are sent to Claude (Anthropic API or claude -p), without code. With probe, probe prompts are sent to the chosen provider. When $STALEMAP_PRECOMPUTED_URL is set, package names (without versions) are sent to that host. The cache is at ~/.cache/stalemap (can be changed with $STALEMAP_CACHE).