Table of Contents
Fetching ...

Language Server CLI Empowers Language Agents with Process Rewards

Yifan Zhang, Lanser Contributors

TL;DR

Lanser-CLI presents a CLI-centric binding of Language Server Protocol servers to autonomous language agents, addressing hallucinations and mislocalization by turning server facts into deterministic, replayable artifacts. It introduces a Selector DSL and a Relocate algorithm to provide robust, edit-surviving addressing, and defines Deterministic Analysis Bundles that capture environment provenance for reproducible offline replay. A safety envelope governs mutating operations, and a process-reward function derived from LSP signals guides online planning and counterfactual analysis, linking intermediate signals to task success. The approach enables auditable planning, safer refactors, and CI-friendly pipelines by grounding agent decisions in machine-checked facts rather than model-internal probabilities. Overall, Lanser-CLI offers a principled framework for trustworthy, reproducible, and auditable interactions between language agents and language servers.

Abstract

Large language models routinely hallucinate APIs and mislocalize edits, while language servers compute verified, IDE-grade facts about real code. We present Lanser-CLI, a CLI-first orchestration layer that pins and mediates a Language Server Protocol (LSP) server for coding agents and CI, exposing deterministic, replayable workflows. Our position is that language servers provide not only structural information (definitions, references, types, diagnostics) but also an actionable process reward: machine-checked, step-wise signals that align an agent's planning loop with program reality. In this work, Lanser-CLI contributes: (i) a robust addressing scheme beyond brittle "file:line:col" via a Selector DSL (symbolic, AST-path, and content-anchored selectors) with a principled relocation algorithm; (ii) deterministic Analysis Bundles that normalize Language Server responses and capture environment/capability metadata with stable content hashes; (iii) a safety envelope for mutating operations (rename, code actions) with preview, workspace jails, and Git-aware, transactional apply; and (iv) a process-reward functional derived from Language Server facts (diagnostic deltas, disambiguation confidence, and safe-apply checks) that is computable online and replayable offline. We formalize determinism under frozen snapshots and establish a monotonicity property for the process reward, making it suitable for process supervision and counterfactual analysis. Project Page: https://github.com/yifanzhang-pro/lanser-cli

Language Server CLI Empowers Language Agents with Process Rewards

TL;DR

Lanser-CLI presents a CLI-centric binding of Language Server Protocol servers to autonomous language agents, addressing hallucinations and mislocalization by turning server facts into deterministic, replayable artifacts. It introduces a Selector DSL and a Relocate algorithm to provide robust, edit-surviving addressing, and defines Deterministic Analysis Bundles that capture environment provenance for reproducible offline replay. A safety envelope governs mutating operations, and a process-reward function derived from LSP signals guides online planning and counterfactual analysis, linking intermediate signals to task success. The approach enables auditable planning, safer refactors, and CI-friendly pipelines by grounding agent decisions in machine-checked facts rather than model-internal probabilities. Overall, Lanser-CLI offers a principled framework for trustworthy, reproducible, and auditable interactions between language agents and language servers.

Abstract

Large language models routinely hallucinate APIs and mislocalize edits, while language servers compute verified, IDE-grade facts about real code. We present Lanser-CLI, a CLI-first orchestration layer that pins and mediates a Language Server Protocol (LSP) server for coding agents and CI, exposing deterministic, replayable workflows. Our position is that language servers provide not only structural information (definitions, references, types, diagnostics) but also an actionable process reward: machine-checked, step-wise signals that align an agent's planning loop with program reality. In this work, Lanser-CLI contributes: (i) a robust addressing scheme beyond brittle "file:line:col" via a Selector DSL (symbolic, AST-path, and content-anchored selectors) with a principled relocation algorithm; (ii) deterministic Analysis Bundles that normalize Language Server responses and capture environment/capability metadata with stable content hashes; (iii) a safety envelope for mutating operations (rename, code actions) with preview, workspace jails, and Git-aware, transactional apply; and (iv) a process-reward functional derived from Language Server facts (diagnostic deltas, disambiguation confidence, and safe-apply checks) that is computable online and replayable offline. We formalize determinism under frozen snapshots and establish a monotonicity property for the process reward, making it suitable for process supervision and counterfactual analysis. Project Page: https://github.com/yifanzhang-pro/lanser-cli
Paper Structure (42 sections, 2 theorems, 3 equations, 1 figure, 1 table, 2 algorithms)

This paper contains 42 sections, 2 theorems, 3 equations, 1 figure, 1 table, 2 algorithms.

Key Result

Proposition 5.1

Fix a workspace snapshot $S$, Language Server server binary and configuration $(V,\Pi)$, negotiated positionEncoding, and request $Q$. Then Lanser-CLI produces identical bundles $B$ across runs, i.e., $\texttt{bundleId}(B)$ is constant.

Figures (1)

  • Figure 1: A language agent interacts with the Lanser-CLI orchestrator, which speaks JSON‑RPC to a pinned LSP server (e.g., Pyright) over a concrete workspace. The orchestrator turns transient protocol sessions into stable artifacts.

Theorems & Definitions (3)

  • Remark 1.1: Bootstrapping
  • Proposition 5.1: Determinism under frozen snapshot
  • Proposition 5.2: Monotonicity of process reward under invariants