Problem
Each lsp-cli invocation spawns a fresh language server (e.g. gopls), waits for initialization, sends one request, and shuts down. The gopls startup cost is ~3 seconds per call, which adds up significantly when an agent makes 10+ navigation calls per task.
In our evaluation, Run B (lsp-cli) was 75% slower wall-clock than Run A (grep/read) despite using fewer tokens, primarily due to this overhead.
Proposal
Add a daemon mode that keeps the language server alive between invocations:
lsp-cli daemon start — start a background language server, listening on a Unix socket
lsp-cli daemon stop — shut it down
- One-shot commands transparently connect to the daemon if running, otherwise fall back to spawning a fresh server
This is the same model gopls uses and would reduce per-call latency from ~3s to near-zero.
Impact
This is the single highest-impact improvement identified in the evaluation. With daemon mode, lsp-cli would be strictly faster than grep for semantic queries while also being more precise.
Design notes
- Socket location:
$XDG_RUNTIME_DIR/lsp-cli/<server>-<root-hash>.sock or similar
- Auto-shutdown after idle timeout (e.g. 10 minutes)
- One daemon per (server, workspace root) pair
- The original design doc discusses this in Phase 4: docs/lsp-cli-design.md
Problem
Each
lsp-cliinvocation spawns a fresh language server (e.g. gopls), waits for initialization, sends one request, and shuts down. The gopls startup cost is ~3 seconds per call, which adds up significantly when an agent makes 10+ navigation calls per task.In our evaluation, Run B (lsp-cli) was 75% slower wall-clock than Run A (grep/read) despite using fewer tokens, primarily due to this overhead.
Proposal
Add a daemon mode that keeps the language server alive between invocations:
lsp-cli daemon start— start a background language server, listening on a Unix socketlsp-cli daemon stop— shut it downThis is the same model gopls uses and would reduce per-call latency from ~3s to near-zero.
Impact
This is the single highest-impact improvement identified in the evaluation. With daemon mode, lsp-cli would be strictly faster than grep for semantic queries while also being more precise.
Design notes
$XDG_RUNTIME_DIR/lsp-cli/<server>-<root-hash>.sockor similar