Language servers
hangar Language intelligence phase (P7)
Language servers live in the daemon, not in the UI. That one decision is why a
rust-analyzer indexing your SSH box can feed the TUI, the desktop app, and a
browser tab at the same time. It is also why “go to definition” means the same
thing everywhere.
Why not per-client servers
Section titled “Why not per-client servers”Four clients each spawning their own server means four indexes, four RAM bills, and four subtly different answers. The daemon already owns the workspace and the host. It is the only component that can run one server in the right place.
Position encodings are negotiated, not assumed
Section titled “Position encodings are negotiated, not assumed”LSP defaults to UTF-16 offsets. The editor buffer is UTF-8 bytes. Applying a UTF-16 offset to a UTF-8 rope works perfectly until someone types an emoji or a CJK character. Then it is off by one column forever.
The daemon therefore advertises general.positionEncodings = ["utf-8", "utf-16"]
and records what each server chooses. It converts at the boundary, with proptests
on emoji, CJK, and combining marks.
Security posture
Section titled “Security posture”A language server is an arbitrary binary with access to your repository and your network. Therefore:
- Trust-pinned. Hashed on first use, prompt once, re-prompt if the binary changes.
- No silent downloads. Detection is the default. A managed install is an
explicit
acpilot lsp install, verified against a signed catalog and the archive’s checksum before it is unpacked (ADR 0014). No timer or startup path fetches one. - Restricted to the workspace root, like agents.
- Timeouts everywhere, plus
$/cancelRequest, plus a crash-loop cap. A wedged server costs a status-line warning, not a frozen editor.
Agents can read diagnostics
Section titled “Agents can read diagnostics”This part is more than an editor feature. The daemon that brokers an agent’s edits also holds the compiler’s opinion of them. An agent can ask for diagnostics as a tool. That turns “did my change compile?” from a guess into a lookup.
Status
Section titled “Status”The first thing a server is used for is references. POST /v1/files/references
takes the file, the caret’s offset and the buffer’s own text alongside the name.
It starts the server installed for that language: rust-analyzer,
pyright-langserver or typescript-language-server, detected on PATH. It then
asks textDocument/references, having opened the buffer as the document the caret
is in. That is what makes an edit nobody has saved yet the text the answer is
about. The list is then scoped rather than spelled: two functions called
new are two functions. A language with no server falls back to a parse-tree
search. That is a feature of the daemon (parse-references, on by default), not a
second client. A build without it links no grammar at all. The GET form, a name
and no buffer, is the spelling search.
A server kept for the next question is also a process kept after the questions
stop. The daemon therefore stops them on its way out: shutdown/exit from the
protocol, and a kill for anything that does not take the hint. A dropped router is
not a dead child. The terminal mirror and the settings watch each hold the state
in a task that outlives serve. The leak was real. Measured on 2026-11-02, one
rust-analyzer survived every daemon that had answered a references request,
still holding its index. Embedded mode stops them the same way when its listener
stops.
A kept session is also a process kept after the questions stop. A server nothing has asked for five minutes is stopped too. The daemon sweeps every thirty seconds, and the next question starts the server again. That is the difference between keeping a session as an optimisation and keeping it as a leak. Someone who walks away from the editor stops paying for an index nobody is reading.
What that machinery is doing is a route rather than a rumour. GET /v1/lsp/servers
answers one row per language this daemon can start: the four the build knows, and
any an activated extension adds. A pack’s preset for a language the build already
knows replaces that row. Activation sits above the built-ins. Deactivating it
puts the build’s row back without a restart. The row says running
or stopped, the encoding it negotiated. The last textDocument/references
round trip in milliseconds. That is the answer, not the index. A language with no row
has no server here, which is what a references list answered by the parse tree
already said. The TUI prints those rows on its status line from the palette’s
LSP status row. That frontend has no : command line yet. The palette’s
own query is where lsp status sits.
A row that came from a pack can also be a question. The daemon pins a language
server the way it pins an agent: POST /v1/lsp/servers/{language}/trust records the
SHA-256 of that program’s bytes. The listing reports untrusted once the file
no longer hashes to what was approved. It is keyed by language because a language is
what a client lists and what a URL can hold. The pin is stored against the
program. typescript-language-server answers for both typescript and javascript,
and one approval covers both. The TUI asks on the palette’s LSP status row when
the list contains such a row. It names the program, the language and the pack. The
question reads, “trust rust-analyzer from acpilot.rust-pack?”. Approving leaves a
sentence on the status line. It does not claim the server started. A pin that is
recorded does not start a process. That question is why the row carries its pack id
all the way to a client.
An answer is enforced, not merely remembered. The daemon refuses to start a server whose bytes no longer hash to the pin it recorded. References fall back to the parse tree, diagnostics report that nobody checked, and formatting returns the buffer unchanged. Rather than running a binary that changed under the name somebody approved. The refusal is local: a remote server’s bytes are the host’s to hash (P7-11). A server nobody has pinned still starts. Requiring an answer before first use is the part of P7-12 still open.
The catalog installer is built and published. acpilot lsp search|install|list|remove
fetches index-v1.json from https://rudeboy.dev/acpilot/lsp/. It checks the detached
signature with the built-in acpilot-lsp key (or ACPILOT_LSP_INDEX_PUBKEY for a
mirror). It verifies the archive’s size and sha256, unpacks only regular files, and
records the executable’s digest under <data>/lsp/<id>/<version>/<target>/. The
first reviewed entry is rust-analyzer’s 2026-11-16 Linux builds. lsp/*.toml is
the source and cargo xtask lsp-index regenerates the signed JSON. The daemon
resolves a managed install ahead of PATH. It now enforces that record as the
P7-12 pin: a managed executable that no longer hashes to install.json is not
started. The daemon does not quietly fall back to a PATH binary instead.
A server found on PATH still uses the existing approval route
POST /v1/lsp/servers/{language}/trust.
The rest of the engine arrives in the language intelligence phase (P7). The
design phase’s P0-7 probe is done. Framing, negotiation, and the UTF-8/UTF-16
conversion are in acpilot-lsp, tested over emoji, CJK, combining marks, and
CRLF. They were proven end-to-end against rust-analyzer,
typescript-language-server, and pyright. The numbers and the capability table
live in the design phase’s P0-7 notes. The short version: two of the three
servers say nothing about encoding and mean UTF-16, so the daemon negotiates and
honours whatever the server answers.
Vibecoded, on purpose. While I am a software developer, I lack the time to hand-code all my ideas, and as a result this project is vibecoded withFreebuff.