stay-fresh-lsp-proxy
Stop stale LSP diagnostics from derailing your Claude Code sessions.
Note: This is a temporary workaround for issues with how Claude Code handles LSP diagnostics. Once the underlying problems are fixed upstream, this plugin will no longer be necessary. Relevant issues:
The Problem
Claude Code's LSP plugins fire textDocument/publishDiagnostics after every edit. The diagnostics arrive from the previous state of the file — not the current one. Claude sees these stale errors, thinks the code is broken, and tries to "fix" problems that don't exist. This leads to:
- Unnecessary reverts — Claude undoes correct work because a stale diagnostic says there's an error
- Fix loops — Claude chases phantom type errors that would resolve on their own after the next save
- Wasted turns — every edit triggers a round of outdated warnings that Claude has to reason about
The root cause is a timing issue: diagnostics lag behind edits, so Claude is always reacting to the previous state of your code.
How It Works
stay-fresh-lsp-proxy sits between Claude Code and your LSP server. It forwards everything normally (go-to-definition, hover, references, completions) but intercepts textDocument/publishDiagnostics notifications and filters them before they reach Claude. No stale diagnostics, no confused AI.
Quick Install
npx stay-fresh-lsp-proxy setup --typescript --python --rust
Pick only the languages you need:
npx stay-fresh-lsp-proxy setup --typescript # Just TypeScript/JS
npx stay-fresh-lsp-proxy setup --typescript --python # TypeScript + Python
npx stay-fresh-lsp-proxy setup --rust # Just Rust
This will:
- Register the plugin marketplace with Claude Code
- Install per-language plugins and disable conflicting official LSP plugins
- Enable the LSP tool in Claude Code settings
Supported Languages
| Language | LSP Server | Install the server |
|---|
| TypeScript/JS | typescript-language-server | npm i -g typescript-language-server typescript |
| Python | pyright-langserver | npm i -g pyright |
| Rust | rust-analyzer | rustup component add rust-analyzer |
The setup script will warn you if the required LSP server binary is not found in your PATH.
Configuration
Control filtering behavior with environment variables. Set them in ~/.claude/settings.json under env:
{
"env": {
"STAY_FRESH_DROP_DIAGNOSTICS": "true",
"STAY_FRESH_MIN_SEVERITY": "1",
"STAY_FRESH_LOG": "false"
}
}
Configuration Reference
| Variable | Default | Description |
|---|
STAY_FRESH_DROP_DIAGNOSTICS | true | Drop all diagnostics. Set to false to use severity filtering instead. |
STAY_FRESH_MIN_SEVERITY | 1 | When not dropping all, the maximum severity level to keep. 1 = only errors, 2 = errors + warnings, 3 = errors + warnings + info, 4 = everything (same as no filter). |
STAY_FRESH_LOG | false | Enable debug logging to $TMPDIR/stay-fresh-lsp-proxy/. |
Recipes
Drop everything (default) — The nuclear option. Eliminates all stale diagnostics completely. Claude keeps full LSP intelligence (go-to-definition, hover, etc.) but never gets misleading error reports mid-edit.
{
"env": {
"STAY_FRESH_DROP_DIAGNOSTICS": "true"
}
}
Errors only — Let genuine errors through (type mismatches, missing imports, syntax errors) but suppress warnings, hints, and info. Good if you want Claude to catch real breakage while ignoring the noise.
{
"env": {
"STAY_FRESH_DROP_DIAGNOSTICS": "false",
"STAY_FRESH_MIN_SEVERITY": "1"
}
}
Errors + Warnings — Also keep warnings (unused variables, deprecated APIs) but drop hints and info. You'll still get some stale notifications, but you're trading that off against Claude occasionally catching real issues it wouldn't otherwise notice.
{
"env": {
"STAY_FRESH_DROP_DIAGNOSTICS": "false",
"STAY_FRESH_MIN_SEVERITY": "2"
}
}
Everything except hints — Only drop hint-level diagnostics (like pyright's "unnecessary" markers that prompted #26634). Closest to stock behavior with the worst offenders removed.
{
"env": {
"STAY_FRESH_DROP_DIAGNOSTICS": "false",
"STAY_FRESH_MIN_SEVERITY": "3"
}
}