cyberine
UsageRun recipes

LSP worker context (lsp_query tool, T312)

Loop workers can query live symbol, definition, reference, and diagnostic information from a Language Server Protocol (LSP) server. A shared warm connection is reused across all workers in a run — no re-spawn per worker.

Install the TypeScript language server:

npm install -g typescript-language-server typescript

Run with LSP context:

# Workers will automatically call lsp_query when the tool is useful
DEEPSEEK_API_KEY=... cyberine run "find all callers of buildRepoMap and refactor them"

# Point at a custom language server binary (command + space-separated args)
CYBERINE_LSP_CMD="typescript-language-server --stdio" cyberine run "..."

Worker tool usage example (within a run):

The lsp_query tool is injected into both implementer and read-only worker tool sets when a language server is available. Workers call it like any other tool:

  • operation: "symbols", symbol: "buildRepoMap" — find where the symbol is defined
  • operation: "definition", file: "src/core/repoMap.ts", line: 183, character: 14 — jump to definition
  • operation: "references", file: "src/core/repoMap.ts", line: 183, character: 14 — find all callers
  • operation: "diagnostics", file: "src/core/repoMap.ts" — pull type errors and warnings

When LSP is unavailable (no binary on $PATH and CYBERINE_LSP_CMD unset), the tool returns a "LSP unavailable" message; the worker falls back to text search without failing the run.

Router preference: When a language server is available, the router floats LSP-capable workers (key-loop workers that receive the Cyberine tool registry) ahead of CLI workers for code tasks.