/lsp <file> command pulls the real diagnostics for a code file — the same errors and warnings your editor would show — by starting the appropriate language server and speaking the Language Server Protocol with it.
/lsp <file> is the manual, per-file command: you pass a file, ChatCLI starts the language server for its language, opens the document, waits for diagnostics and prints them. Separately, the @coder engine now automatically checks the files it just edited — see Automatic post-edit diagnostics below.How it works
- Language detection — by file extension.
- Spawn — starts the language’s server (default command or your override). If the binary isn’t installed/on
PATH,/lspsays so. - Handshake —
initialize+textDocument/didOpen. - Diagnostics — waits up to 12s for
textDocument/publishDiagnosticsand renders the result.
Languages and default commands
Each language uses a conventional stdio command, overridable via an environment variable. The binary must be installed and onPATH.
Usage
Automatic post-edit diagnostics
You no longer have to run/lsp by hand to catch a broken edit. In /agent and /coder, after a successful @coder write, patch or multipatch, the engine runs the language server over the files it just touched and appends any findings to the tool result as a compact [DIAGNOSTICS] block:
- On by default, toggled with
CHATCLI_CODER_AUTODIAG(off/false/noto disable). - Silent on clean files — a file with no diagnostics appends nothing, so the happy path costs zero tokens.
- Bounded — at most 5 files per edit, a 3000-character budget for the block, and a wall-clock budget for the whole pass; overflow and skipped files are elided with an explicit note.
- Never blocks on a cold server — if the session pool hasn’t started a server for that language yet, the check reports nothing now, warms the server in the background, and the next edit gets real findings. Your write’s result renders immediately either way.
- Degrades to a no-op when no language server is available for the file’s language (or when running on a surface without the session LSP pool). It reuses the same session-scoped server pool as the
@lsptool below, so there’s no extra startup cost.
The @lsp tool — semantic navigation for the agent
The same LSP engine is also available to the model in agent and coder modes as the@lsp builtin tool — backed by a session-scoped server pool (the server initializes once per project and is reused across calls; idle servers shut down after 15 minutes):
Positions are 1-based both ways. Where
@search finds text, @lsp understands code: after editing a file, diagnostics confirms it still compiles; before changing a symbol, references shows the blast radius.